前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何用Python找回微信撤回信息

如何用Python找回微信撤回信息

原创
作者头像
程序员小二
发布2022-01-06 17:04:16
1.7K0
发布2022-01-06 17:04:16
举报
文章被收录于专栏:python小分享python小分享

在互联网飞速发展的下、民众的需求下,已经进入全民微信时代。村口的张大妈,家里的老父亲都知道怎么使用微信。

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

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

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

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

代码语言:javascript
复制

mport re

import time

import itchat

from itchat.content import *

@itchat.msg_register([TEXT, PICTURE, MAP, CARD, NOTE, SHARING, RECORDING, ATTACHMENT, VIDEO])

def text_reply(msg):
	
	print(msg['Text'])
	
	@itchat.msg_register([TEXT, PICTURE, MAP, CARD, NOTE, SHARING, RECORDING, ATTACHMENT, VIDEO])
	
	@itchat.msg_register([TEXT, PICTURE, MAP, CARD, NOTE, SHARING, RECORDING, ATTACHMENT, VIDEO])
	
	def text_reply(msg):
		
		if msg['Type'] == 'Text':
			
			reply_content = msg['Text']
			
		elif msg['Type'] == 'Picture':
			
			reply_content = r"图片: " + msg['FileName']
			
		elif msg['Type'] == 'Card':
			
			reply_content = r" " + msg['RecommendInfo']['NickName'] + r" 的名片"
			
		elif msg['Type'] == 'Map':
			
			x, y, location = re.search("<location x=\"(.*?)\" y=\"(.*?)\".*label=\"(.*?)\".*",  msg['OriContent']).group(1,
			
			2,
			
			3)
			
			if location is None:
				
				reply_content = r"位置: 纬度->" + x.__str__() + " 经度->" + y.__str__()
				
			else:
				
				reply_content = r"位置: " + location
				
			elif msg['Type'] == 'Note':
				
				reply_content = r"通知"
				
			elif msg['Type'] == 'Sharing':
				
				reply_content = r"分享"
				
			elif msg['Type'] == 'Recording':
				
				reply_content = r"语音"
				
			elif msg['Type'] == 'Attachment':
				
				reply_content = r"文件: " + msg['FileName']
				
			elif msg['Type'] == 'Video':
				
				reply_content = r"视频: " + msg['FileName']
				
			else:
				
				reply_content = r"消息"
				
				friend = itchat.search_friends(userName=msg['FromUserName'])
				
				itchat.send(r"Friend:%s -- %s "
				
				r"Time:%s "
				
				r" Message:%s" % (friend['NickName'], friend['RemarkName'], time.ctime(),   reply_content),
				
				toUserName='filehelper')
				
				itchat.send(r"我已经收到你在【%s】发送的消息【%s】稍后回复。--微信助手(Python版)" % (time.ctime(), reply_content),
				
				toUserName=msg['FromUserName'])
				
				itchat.auto_login()
				
				itchat.run()

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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档