微信(WeChat) 是腾讯公司于2011年1月21日推出的一个为智能终端提供即时通讯服务的免费应用程序,由张小龙所带领的腾讯广州研发中心产品团队打造 。在互联网飞速发展的下、民众的需求下,微信已经更新到2.6.2.31版本,全民微信时代。村口的张大妈,家里的老父亲都知道怎么使用微信。

但是当我们与朋友,亲人,爱人聊天的时候,我估计每个人都经历过,那就是微信撤回功能中所提到的,对方撤回一条消息。

一条撤回的消息,就像一个秘密,让你迫切地想去一探究竟;或如一个诱饵,瞬间勾起你强烈的兴趣。你想知道,那是怎样的一句话?是对方不慎讲出的真话,还是一句发错了对象的话?

微信查看撤回消息小程序(用Python找回微信撤回信息)(1)

总之,这个撤回的消息,让人顿生×××。这个时候,就是技术人员出马的时候了。

微信查看撤回消息小程序(用Python找回微信撤回信息)(2)

Python查看微信撤回消息参考代码:

import itchat from itchat.content import * import os import time import xml.dom.minidom temp = 'C:/Users/Administrator/Desktop/CrawlerDemo' '/' '撤回的消息' if not os.path.exists(temp): os.mkdir(temp) itchat.auto_login(True) dict = {} @itchat.msg_register([TEXT, PICTURE, FRIENDS, CARD, MAP, SHARING, RECORDING, ATTACHMENT, VIDEO]) def resever_info(msg): global dict info = msg['Text'] msgId = msg['MsgId'] info_type = msg['Type'] name = msg['FileName'] fromUser = itchat.search_friends(userName=msg['FromUserName'])['NickName'] ticks = msg['CreateTime'] time_local = time.localtime(ticks) dt = time.strftime("%Y-%m-%d %H:%M:%S", time_local) dict[msgId] = {"info": info, "info_type": info_type, "name": name, "fromUser": fromUser, "dt": dt} @itchat.msg_register(NOTE) def note_info(msg): if '撤回了一条消息' in msg['Text']: content = msg['Content'] doc = xml.dom.minidom.parseString(content) result = doc.getElementsByTagName("msgid") msgId = result[0].childNodes[0].nodeValue msg_type = dict[msgId]['info_type'] if msg_type == 'Recording': recording_info = dict[msgId]['info'] info_name = dict[msgId]['name'] fromUser = dict[msgId]['fromUser'] dt = dict[msgId]['dt'] recording_info(temp '/' info_name) send_msg = '【发送人:】' fromUser '\n' '发送时间:' dt '\n' '撤回了一条语音' itchat.send(send_msg, 'filehelper') itchat.send_file(temp '/' info_name, 'filehelper') del dict[msgId] print("保存语音") elif msg_type == 'Text': text_info = dict[msgId]['info'] fromUser = dict[msgId]['fromUser'] dt = dict[msgId]['dt'] send_msg = '【发送人:】' fromUser '\n' '发送时间:' dt '\n' '撤回内容:' text_info itchat.send(send_msg, 'filehelper') del dict[msgId] print("保存文本") elif msg_type == 'Picture': picture_info = dict[msgId]['info'] fromUser = dict[msgId]['fromUser'] dt = dict[msgId]['dt'] info_name = dict[msgId]['name'] picture_info(temp '/' info_name) send_msg = '【发送人:】' fromUser '\n' '发送时间:' dt '\n' '撤回了一张图片' itchat.send(send_msg, 'filehelper') itchat.send_file(temp '/' info_name, 'filehelper') del dict[msgId] print("保存图片") itchat.run() 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889

微信查看撤回消息小程序(用Python找回微信撤回信息)(3)

这篇文章到这里就结束了,不过在此真心建议,如果是男女朋友,就不要去用Python查看了,有些事情不知道比知道要好。亲身经历。

,