Py学习  »  Python

python帮你找回来....

大数据分析和人工智能 • 5 年前 • 419 次点击  

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

总之,这个撤回的消息,让人顿生无限遐想。这个时候,就是技术人员出马的时候了,哪门子技术人员?如题:Python程序员!

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

  1. import re

  2. import time

  3. import itchat

  4. from itchat.content import *

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

  6. def text_reply(msg):

  7. print(msg['Text'])

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

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

  10. def text_reply(msg):

  11. if msg ['Type'] == 'Text':

  12. reply_content = msg['Text']

  13. elif msg['Type'] == 'Picture':

  14. reply_content = r"图片: " + msg['FileName']

  15. elif msg['Type'] == 'Card':

  16. reply_content = r" " + msg['RecommendInfo']['NickName'] + r" 的名片"

  17. elif msg['Type'] == 'Map':

  18. x, y, location = re.search(", msg['OriContent']).group(1,

  19. 2,

  20. 3)

  21. if location is None:

  22. reply_content = r "位置: 纬度->" + x.__str__() + " 经度->" + y.__str__()

  23. else:

  24. reply_content = r"位置: " + location

  25. elif msg['Type'] == 'Note':

  26. reply_content = r"通知"

  27. elif msg['Type'] == 'Sharing':

  28. reply_content = r"分享"

  29. elif msg['Type'] == 'Recording':

  30. reply_content = r "语音"

  31. elif msg['Type'] == 'Attachment':

  32. reply_content = r"文件: " + msg['FileName']

  33. elif msg['Type'] == 'Video':

  34. reply_content = r"视频: " + msg['FileName']

  35. else:

  36. reply_content = r"消息"

  37. friend = itchat.search_friends(userName=msg['FromUserName'])

  38. itchat.send(r"Friend:%s -- %s "

  39. r"Time:%s "

  40. r" Message:%s" % (friend['NickName'], friend['RemarkName'], time.ctime(), reply_content),

  41. toUserName='filehelper')

  42. itchat.send(r"我已经收到你在【%s】发送的消息【%s】稍后回复。--微信助手(Python版)" % (time.ctime(), reply_content),

  43. toUserName=msg['FromUserName'])

  44. itchat.auto_login()

  45. itchat.run()



最后推荐爱数圈组织的第一次线下课程,课程特点:

  • 爆款营销话题,最接“地气”的思维模型

  • 超一线最新的品牌实战案例

  • 被多家媒体报道的热门主题课

  • 长江商学院数据前沿课

  • 开眼、实战、体系化、接地气!

  • 我们将从实战的角度去讲如何应用数据产生价值

详细点击→_→:最新的案例、最前沿的思维模型玩转数据


今天看啥 - 高品质阅读平台
本文地址:http://www.jintiankansha.me/t/XlqjTkYhgJ
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/12371
 
419 次点击