python获取微信用户(python-itchat 获取微信群用户信息的实例)
类别:脚本大全 浏览量:1468
时间:2022-03-29 03:02:52 python获取微信用户
python-itchat 获取微信群用户信息的实例如下所示:
|
import itchat, time from itchat.content import TEXT #name = ' ' roomslist = [] itchat.auto_login(enableCmdQR = False ) def getroom_message(n): #获取群的username,对群成员进行分析需要用到 itchat.dump_login_status() # 显示所有的群聊信息,默认是返回保存到通讯录中的群聊 RoomList = itchat.search_chatrooms(name = n) if RoomList is None : print ( "%s group is not found!" % (name)) else : return RoomList[ 0 ][ 'UserName' ] def getchatrooms(): #获取群聊列表 roomslist = itchat.get_chatrooms() #print(roomslist) return roomslist for i in getchatrooms(): #print(i['NickName']) roomslist.append(i[ 'NickName' ]) with open ( '群用户名.txt' , 'a' , encoding = 'utf-8' )as f: for n in roomslist: ChatRoom = itchat.update_chatroom(getroom_message(n), detailedMember = True ) for i in ChatRoom[ 'MemberList' ]: #print (i['Province']+":",i['NickName']) f.write(i[ 'Province' ] + ":" + i[ 'NickName' ] + '\n' ) print ( '正在写入 ' + i[ 'Province' ] + ":" ,i[ 'NickName' ]) f.close() # for i in ChatRoom: # print(i['MemberList']['ContactList']) # count += 1 # print(count) # # @itchat.msg_register(TEXT) # # def simple_reply(TEXT): # # print(msg.text) # # # # itchat.auto_login(enableCmdQR = False,hotReload = True) # enableCmdQR=True这一参数为二维码在下面控制台中显示出来,而不是用图片显示 # # itchat.run() # itchat.auto_login(enableCmdQR = False) # # # time.sleep() # # itchat.logout() # # friends = itchat.get_friends() # # for i in friends: # # print(i) # rooms = itchat.get_chatrooms() # for i in rooms: # print(i['NickName']) # memberList = itchat.update_chatroom(i['NickName']) # print (memberList) # # # room = itchat.update_chatroom(i['NickName'],detailedMember = True) # # print(room) # # # for i in room: # # # print(i) |
以上这篇python-itchat 获取微信群用户信息的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持开心学习网。
原文链接:https://blog.csdn.net/localhost1113/article/details/79443292
您可能感兴趣
- python时间类的实现(Python日期时间Time模块实例详解)
- python脚本压缩包解密(详解Python 解压缩文件)
- python弹跳小球(python GUI实现小球满屏乱跑效果)
- python中pip和pip3有什么区别(ISAPI-REWRITE伪静态规则写法以及说明)
- pythonmatplotlib怎么设置图像(完美解决Python matplotlib绘图时汉字显示不正常的问题)
- python微信窗口内容获取(python使用wxpy轻松实现微信防撤回的方法)
- python零基础实战项目(十个Python练手的实战项目,学会这些Python就基本没问题了推荐)
- python编辑redis(python使用pipeline批量读写redis的方法)
- python 常用爬虫库(Python常用爬虫代码总结方便查询)
- python中字典的主要特点(Python里字典的基本用法包括嵌套字典)
- python调用支付宝支付接口(python实现支付宝转账接口)
- pythonyield使用场景(Yii框架核心组件类实例详解)
- python的环境变量怎么设置(详解如何设置Python环境变量?)
- python利用空列表进行数字排序(python实现计数排序与桶排序实例代码)
- python3 怎么查看函数用法(Python3 max函数基础用法)
- pythonopt用法(Python语言检测模块langid和langdetect的使用实例)
- 数字藏品市场有多乱 周杰伦丢了 一只猴 ,损失超300万(数字藏品市场有多乱)
- 这里输入关键词(怎么输入关键词搜索)
- 得这个 难治病 的人太多了,300个人赶到杭州商量怎么办(得这个难治病的人太多了)
- 经度,世界时间腕表的灵魂(世界时间腕表的灵魂)
- 阿里最新财报公布 三季度营收增长3 ,将增加150亿美元回购额度 在美股价小涨(阿里最新财报公布)
- 赵薇时胖时瘦 最近变美少女 原因在这里 躺着就变瘦(赵薇时胖时瘦最近变美)
热门推荐
- flow布局(详解为什么设置overflow为hidden可以清除浮动带来的影响)
- ssl服务器搭建的步骤(windows apache环境下部署SSL证书让网站支持https的配置方法)
- laravel如何设置默认模块(Laravel框架控制器的middleware中间件用法分析)
- tp5框架源码分析(tp5框架无刷新分页实现方法分析)
- sqlserver连接字符串函数(SQL SERVER 2012新增函数之字符串函数FORMAT详解)
- sqlserver字符串判断函数(解决sql server保存对象字符串转换成uniqueidentifier失败的问题)
- python控制流实例(如何用C代码给Python写扩展库Cython)
- dedecms5.7使用教程(dedecms v5.7提示php.ini register_globals must is Off错误的解决方法)
- python的编码方式(Python中文编码知识点)
- canvas 裁剪画布(Canvas图片分割效果的实现)
排行榜
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9