fix when contacts are deleted
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
## 导出安卓微信聊天数据
|
||||
|
||||
WeChat(微信), as the most popular mobile IM app in China, failed to allow users to export well-formatted chat history.
|
||||
This tool can parse and export WeChat message history on a rooted android phone.
|
||||
WeChat(微信), as the most popular mobile IM app in China, doesn't give users any method to export well-formatted history message.
|
||||
This tool can parse and export WeChat messages on a rooted android phone.
|
||||
|
||||
It can generate single-file html containing all the messages, including voice message, image, emoji, etc.
|
||||
It can generate single-file html containing all the messages, including voice messages, images, emoji, etc.
|
||||
|
||||
__NEWS__: WeChat 6.0+ use silk to encode audio. The code is updated.
|
||||
|
||||
@@ -17,8 +17,8 @@ __NEWS__: WeChat 6.0+ use silk to encode audio. The code is updated.
|
||||
+ [pysox](https://pypi.python.org/pypi/pysox/0.3.6.alpha)
|
||||
+ [pysqlcipher](https://pypi.python.org/pypi/pysqlcipher)
|
||||
+ numpy
|
||||
+ python-csscompressor(optional)
|
||||
+ adb and rooted android phone connected to PC
|
||||
+ python-csscompressor (suggested, optional)
|
||||
+ adb and rooted android phone connected to a Linux/Mac OS.
|
||||
+ Silk audio decoder (just run `./third-party/compile_silk.sh`)
|
||||
+ gnu-sed
|
||||
|
||||
|
||||
+4
-3
@@ -58,10 +58,11 @@ SELECT {} FROM message
|
||||
msg = WeChatMsg(row)
|
||||
if not WeChatMsg.filter_type(msg.type):
|
||||
self.msgs_by_talker[msg.talker].append(msg)
|
||||
#if msg.type > 10000 or msg.type < 0:
|
||||
#print repr(msg).split('|')[0]
|
||||
|
||||
# It's possible that messages are kept in database after contacts been deleted
|
||||
# TODO handle this with a random contact name
|
||||
self.msgs_by_talker = {self.contacts[k]: sorted(v, key=lambda x: x.createTime)
|
||||
for k, v in self.msgs_by_talker.iteritems()}
|
||||
for k, v in self.msgs_by_talker.iteritems() if k in self.contacts}
|
||||
for k, v in self.msgs_by_talker.iteritems():
|
||||
for msg in v:
|
||||
msg.talker_name = ensure_unicode(k)
|
||||
|
||||
Reference in New Issue
Block a user