python微信点赞脚本_你写过的最好的 Python 脚本是什么?
利用itchat模块登录网页版微信,将自己微信收到的所有消息都缓存下来,当检测到有消息撤回时,将撤回消息的缓存版本通过文件传输助手发送到自己的手机上。
于是你就可以看到别人撤回的消息是什么了!!!
效果是这样的:
源代码:
# Python查看微信撤回消息
# 公众号: Charles的皮卡丘
# 作者: Charles
import re
import os
import time
import itchat
import platform
from itchat.content import TEXT
from itchat.content import *
msg_info = {}
face_package = None
# 处理接收到的信息
@itchat.msg_register([TEXT, PICTURE, FRIENDS, CARD, MAP, SHARING, RECORDING, ATTACHMENT, VIDEO], isFriendChat=True, isMpChat=True)
def handleRMsg(msg):
global face_package
# 接收消息的时间
msg_time_receive = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
# 发信人
try:
msg_from = itchat.search_friends(userName=msg['FromUserName'])['NickName']
except:
msg_from = 'WeChat Official Accounts'
# 发信时间
msg_time_send = msg['CreateTime']
# 信息ID
msg_id = msg['MsgId']
msg_content = None
msg_link = None
# 文本或者好友推荐
if msg['Type'] == 'Text' or msg['Type'] == 'Friends':
msg_content = msg['Text']
print('[Text/Friends]: %s' % msg_content)
# 附件/视频/图片/语音
elif msg['Type'] == 'Attachment' or msg['Type'] == "Video" or msg['Type'] == 'Picture' or msg['Type'] == 'Recording':
msg_content = msg['FileName']
msg['Text'](str(msg_content))
print('[Attachment/Video/Picture/Recording]: %s' % msg_content)
# 推荐名片
elif msg['Type'] == 'Card':
msg_content = msg['RecommendInfo']['NickName'] + '的推荐名片,'
if msg['RecommendInfo']['Sex'] == 1:
msg_content += '性别男。'
else:
msg_content += '性别女。'
print('[Card]: %s' % msg_content)
# 位置信息
elif msg['Type'] == 'Map':
x, y, location = re.search("
if location is None:
msg_content = r"纬度:" + x.__str__() + ", 经度:" + y.__str__()
else:
msg_content = r"" + location
print('[Map]: %s' % msg_content)
# 分析的音乐/文章
elif msg['Type'] == 'Sharing':
msg_content = msg['Text']
msg_link = msg['Url']
print('[Sharing]: %s' % msg_content)
msg_info.update(
{
msg_id: {
"msg_from": msg_from,
"msg_time_send": msg_time_send,
"msg_time_receive": msg_time_receive,
"msg_type": msg["Type"],
"msg_content": msg_content,
"msg_link": msg_link
}
}
)
face_package = msg_content
# 监听是否有消息撤回
@itchat.msg_register(NOTE, isFriendChat=True, isGroupChat=True, isMpChat=True)
def monitor(msg):
if '撤回了一条消息' in msg['Content']:
recall_msg_id = re.search("\(.*?)\<\/msgid\>", msg['Content']).group(1)
recall_msg = msg_info.get(recall_msg_id)
print('[Recall]: %s' % recall_msg)
# 表情包
if len(recall_msg_id) < 11:
itchat.send_file(face_package, toUserName='filehelper')
else:
msg_prime = '---' + recall_msg.get('msg_from') + '撤回了一条消息---\n' \
'消息类型:' + recall_msg.get('msg_type') + '\n' \
'时间:' + recall_msg.get('msg_time_receive') + '\n' \
'内容:' + recall_msg.get('msg_content')
if recall_msg['msg_type'] == 'Sharing':
msg_prime += '\n链接:' + recall_msg.get('msg_link')
itchat.send_msg(msg_prime, toUserName='filehelper')
if recall_msg['msg_type'] == 'Attachment' or recall_msg['msg_type'] == "Video" or recall_msg['msg_type'] == 'Picture' or recall_msg['msg_type'] == 'Recording':
file = '@fil@%s' % (recall_msg['msg_content'])
itchat.send(msg=file, toUserName='filehelper')
os.remove(recall_msg['msg_content'])
msg_info.pop(recall_msg_id)
if __name__ == '__main__':
if platform.platform()[:7] == 'Windows':
itchat.auto_login(enableCmdQR=False, hotReload=True)
else:
itchat.auto_login(enableCmdQR=True, hotReload=True)
itchat.run()
顺便你还可以分析一下微信好友的构成:Python简单分析微信好友mp.weixin.qq.com
当然你也可以预测预测自己的颜值!Python实现颜值预测mp.weixin.qq.com
做个AI五子棋:Python实现AI五子棋【初版】mp.weixin.qq.com
用Python和Excel生成小姐姐:【Python+VBA】在Excel中生成小姐姐mp.weixin.qq.com
欢迎搜索关注我的微信公众号:Charles的皮卡丘
不定期分享更多有趣好玩的Python脚本~
python微信点赞脚本_你写过的最好的 Python 脚本是什么?相关推荐
- python实现阴阳师自动刷御魂脚本_自己写的yys御魂python脚本
[Python] 纯文本查看 复制代码print("正在加载库") import win32api import win32con import time import rando ...
- 为什么说python是万能的_为什么说”人生苦短,我用python“
首先我们要说明的是本文不扯什么大道理,只是先介绍Python的背景,然后从实用的角度出发举一两个真实栗子. 这里写图片描述 首先要想了解要一门语言的好坏,或者为什么招程序员喜欢(卧槽,原来程序员喜欢不 ...
- python实验报告代写_TensorFlow作业代写、代做Python程序语言作业、代写github课程作业、Python实验作业代写...
TensorFlow作业代写.代做Python程序语言作业.代写github课程作业.Python实验作业代写 日期:2019-07-10 10:34 Python Practical Examine ...
- python微信点赞脚本_用OpenCV-python的微信跳一跳外挂脚本
微信跳一跳好像火了很久了,我才开始接触,作为一个手残党, 玩了几次不到20分,打算直接放弃了.但作为一个技术宅,下一反应肯定是"上脚本".最初想法是用arduino(不会可以学啊) ...
- python微信群管理_利用python实现在微信群刷屏的方法
hello,我是小小炽,这是我写的第一篇博客,写博客一直都想在写,但是苦于能力尚浅,在各位大牛面前那既然是关公面前耍大刀了,但是其实想来每一个大牛不也是从一个小白慢慢进步学习从而达到一定的高度的吗,而 ...
- python阴阳师脚本_阴阳师肝不动了,试试Python吧
引子 啰嗦的部分,可以跳过 前几日入了阴阳师的坑,经过了前期的快速升级后,发现这个游戏真的是要肝啊.每天都是身体被掏空了.不知道大家有没有感觉,就是这个游戏吧,也不需要集中什么注意力,但是隔一会儿就要 ...
- python录制生成自动化脚本_懒人做自动化测试之二--自动化脚本录制
自己造轮子多麻烦,如果有现成的轮子可以利用,何不直接拿过来用呢. 听说谷歌发布了一款由网易研发的游戏 UI 自动化测试方案:Airtest Project.谷歌方面表示 Airtest 是安卓游戏开发 ...
- python作者 google面试_如果Google面试让你用python写一个树的遍历程序
前几天忽然对python很感兴趣,学了几天也感觉它非常的简洁实用.打破了我这么长时间对java C# C 和vb的审美疲劳,让我眼前一亮."就像读英文一样简单"这句话评价pytho ...
- 微信公众号怎么集赞服务器,【微信点赞】_微信怎么点赞如何集赞微信点赞活动新手必备点赞教程...
一.了解点赞起源历史 点赞自2010年诞生以来,大拇指点"赞"按钮迅速被人们接受,而后成为facebook的另一种标志. 后面到百度,qq空间,新浪微博,腾讯微博都添加了点赞按钮, ...
最新文章
- linux教程 sed命令的用法,Linux文本处理三剑客——sed命令使用教程
- 2018蓝桥杯省赛---java---B---2(方格计数)
- PHP技术亮点,我眼里的THINKPHP5新亮点(1)
- VB添加listbox 的水平卷动轴
- JBoss企业级应用服务平台群集指南(一)
- FTP连接报530错误(FTP Error: 530 User cannot log in, home directory inaccessible)
- 认认真真推荐10个牛逼公号!
- js 表格动态增加行通用函数
- 计算机数字雨代码,cmd命令数字雨教程
- 盘点那些不为大众所知,却暗地里很“牛逼”的软件
- 黑群晖linux删除文件夹命令,不拆机直接修改黑群晖的SN和MAC
- 15 分钟 教你搞一个专属于你的域名邮箱
- Windows漏洞补丁更新网址
- 教你如何用PS轻松制作ico图标
- python爬数据是什么意思-爬数据是什么意思?
- vue项目设置浏览器标题title及图标
- 街头立体画的创作过程
- yii2项目实战-博客管理平台的搭建
- 学习-Java循环之continue
- tomcat 运行提示The background cache eviction process was unable to free
热门文章
- C++项目代码规范(偶自用)
- ASP网页中 制作连续无缝滚动文字
- Java 学习经验[转]
- fatal: 无法访问 ‘x.git/‘gnutls_handshake() failed: The TLS connection was non-properly terminated.解决办法
- Android音视频【六】视频数据存储方式YUV
- python连接linux后一步一步的操作_Python使用技巧
- 多网卡Iptables端口转发
- android7.0 Jack编译器报错解决
- Bluetooth的profile总结
- Ubuntu20.04如何卸载软件