Skip to content

Commit

Permalink
Fix re bug of trasferring
Browse files Browse the repository at this point in the history
  • Loading branch information
littlecodersh committed Oct 18, 2016
1 parent 35656c6 commit f87c03f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion itchat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .client import client
from . import content # this is for creating pyc

__version__ = '1.1.13'
__version__ = '1.1.14'

__client = client()
def auto_login(hotReload=False, statusStorageDir='itchat.pkl', enableCmdQR=False):
Expand Down
15 changes: 11 additions & 4 deletions itchat/client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#coding=utf8
import os, sys, time, re, io
import threading, subprocess
import json, xml.dom.minidom, mimetypes
Expand Down Expand Up @@ -280,9 +281,10 @@ def __produce_msg(self, l):
if m['Url']:
regx = r'(.+?\(.+?\))'
data = re.search(regx, m['Content'])
data = 'Map' if data is None else data.group(1)
msg = {
'Type': 'Map',
'Text': data.group(1),}
'Text': data,}
else:
msg = {
'Type': 'Text',
Expand Down Expand Up @@ -363,11 +365,15 @@ def download_atta(attaDir=None):
'Type': 'Note',
'Text': m['FileName'], }
elif m['AppMsgType'] == 2000:
regx = r'\[CDATA\[(.+?)\].+?\[CDATA\[(.+?)\]'
regx = r'\[CDATA\[(.+?)\][\s\S]+?\[CDATA\[(.+?)\]'
data = re.search(regx, m['Content'])
if data:
data = data.group(2).split(u'。')[0]
else:
data = 'You may found detailed info in Content key.'
msg = {
'Type': 'Note',
'Text': data.group(2), }
'Text': data, }
else:
msg = {
'Type': 'Sharing',
Expand Down Expand Up @@ -400,9 +406,10 @@ def download_video(videoDir=None):
elif m['MsgType'] == 10002:
regx = r'\[CDATA\[(.+?)\]\]'
data = re.search(regx, m['Content'])
data = 'System message' if data is None else data.group(1).replace('\\', '')
msg = {
'Type': 'Note',
'Text': data.group(1).replace('\\', ''), }
'Text': data, }
elif m['MsgType'] in srl:
msg = {
'Type': 'Useless',
Expand Down

0 comments on commit f87c03f

Please sign in to comment.