Example of python-itchat to get wechat group user information
As shown below:
import itchat, time from import TEXT #name = ' ' roomslist = [] itchat.auto_login(enableCmdQR = False) def getroom_message(n): # Get the username of the group, which is needed to analyze the group members. itchat.dump_login_status() # Show all group chats, default is to return to the group chats saved in the address book RoomList = itchat.search_chatrooms(name=n) if RoomList is None: print("%s group is not found!" % (name)) else: return RoomList[0]['UserName'] def getchatrooms(): # Get list of group chats roomslist = itchat.get_chatrooms() #print(roomslist) return roomslist for i in getchatrooms(): #print(i['NickName']) (i['NickName']) with open('Group username.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']) (i['Province']+":"+i['NickName']+'\n') print('Writing '+i['Province']+":",i['NickName']) () # for i in ChatRoom: # print(i['MemberList']['ContactList']) # count += 1 # print(count) # # @itchat.msg_register(TEXT) # # def simple_reply(TEXT): # # print() # # # # itchat.auto_login(enableCmdQR = False,hotReload = True) # enableCmdQR=True This parameter is for the QR code to be displayed in the console below, instead of using an image. # # () # itchat.auto_login(enableCmdQR = False) # # # () # # () # # 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)
The above example of this python-itchat to get the information of WeChat group users is all I have shared with you, I hope it can give you a reference, and I hope you can support me more.
Related articles
python implementation of the ID card photo to change the background function
This article is mainly for you to introduce in detail the realization of the python document photo bottom function, with certain reference value, interested partners can refer to it!2019-08-08Python 2.7 Delete Folder and Delete File Code Examples
python delete folder t and delete file code example, we refer to the use of it, the operating environment is python2.72013-12-12python finds files containing keywords and deletes folder ways
This article introduces python to find files containing keywords and delete folder way, has a good reference value, I hope to help you. If there is any error or not fully considered, please do not hesitate to advise!2022-02-02Python web crawler god PyQuery basic use tutorial
This article introduces the basic use of the Python network crawler artifact PyQuery tutorials, the text through the sample code is very detailed, for everyone to learn to use PyQuery has a certain reference learning value, the need for friends below with the editorial to learn together.2018-02-02Python Shiny Library for Creating Interactive Web Applications and Advanced Feature Cases
Shiny is a Python-based interactive Web application framework , focusing on simplifying the Web application development process , this article will discuss the basic usage of the Shiny library , advanced features and practical application cases to help developers give full play to the advantages of Shiny in Web application development .2023-12-12python 30 lines of code to implement automatic energy stealing from ant forests
This article mainly introduces the python 30 lines of code to achieve the ant forest automatically steal energy, to help you better understand and learn to use python, interested parties can understand the following2021-02-02Use python to implement regular matching to retrieve files in a remote FTP directory
This article mainly introduces the use of python to achieve regular matching to retrieve files in the remote FTP directory method, very simple and practical, the need for small partners refer to the following2015-03-03Python gets the contents of the middle of the specified beginning and end of the specified end (recommended).
Access to the article specified in the beginning, specified in the end of the content of the clip. Among them, the beginning and the end are a variety of, but up to a dozen, so the code is still feasible, today I introduce to you through Python to get the specified beginning of the specified end of the contents of the middle of the folder, interested friends to look at it together!2023-02-02Pytorch uses tensor specific conditions to determine indexing
This article introduces Pytorch using tensor specific conditions to determine the operation of the index, has a good reference value, I hope to help you. Together follow the editor over to see it2021-04-04How to read QR code information from desktop with Python in detail
QR code as a tool for information transfer in today's society plays an important role, the following article introduces how to use Python to read QR code information from the desktop information, the text is very detailed through the sample code, friends can refer to the following2021-10-10