<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>群消息 on GbyAI</title>
    <link>https://blog.gby.ai/tags/%E7%BE%A4%E6%B6%88%E6%81%AF/</link>
    <description>Recent content in 群消息 on GbyAI</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh</language>
    <copyright>Content under license [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)</copyright>
    <lastBuildDate>Wed, 22 May 2019 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.gby.ai/tags/%E7%BE%A4%E6%B6%88%E6%81%AF/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>py 自动抓取微信群消息</title>
      <link>https://blog.gby.ai/grap-wechat-group-message/</link>
      <pubDate>Wed, 22 May 2019 00:00:00 +0000</pubDate>
      <guid>https://blog.gby.ai/grap-wechat-group-message/</guid>
      <description>准备 准备一个 17 年之前的微信号，新账号有限制不可以登录网页微信扫码
准备国内的域名和服务器
过程 准备机器定时运行 py 脚本（可以用别的写） 本人微信自我检测时间验证最长为 1 天 12 个小时，最短几个小时，可以 crontab 设置10分钟检测登录状态，没有登录则发送微信或者邮件（免费 Mailgun）登录微信扫码图片，扫码登录即可
检测脚本抓到的固定群里面的固定信息（自己定义群名和信息），自己处理即可，无论入库分析，还是实时发送指定消息,可自由发挥
脚本例子 # 抓取所有加入“拼车”群名的群消息，找到包含“车找人”的消息，写入到wechat.log文件中 #!/usr/bin/python # coding:utf8 import logging,logging.handlers import itchat import time from itchat.content import * logging.basicConfig() myapp = logging.getLogger(&amp;#39;myapp&amp;#39;) myapp.setLevel(logging.INFO) filehandler = logging.handlers.TimedRotatingFileHandler(&amp;#34;./wechat.log&amp;#34;, when=&amp;#39;D&amp;#39;, interval=1) filehandler.suffix = &amp;#34;%Y-%m-%d.log&amp;#34; myapp.addHandler(filehandler) # 注册文字信息 设置为群聊信息 @itchat.msg_register([TEXT], isGroupChat=True) def group_reply_text(msg): if msg[&amp;#39;Type&amp;#39;] == TEXT: content = msg[&amp;#39;Content&amp;#39;] if &amp;#39;车找人&amp;#39; in content: myapp.info(&amp;#39;||%s&amp;#39; %content) itchat.auto_login(enableCmdQR=2) # 获取所有通讯录中的群聊 # 需要在微信中将需要同步的群聊都保存至通讯录 itchat.</description>
    </item>
  </channel>
</rss>
