In [1]: import itchat
In [2]: itchat.login()
#爬取自己好友相关信息,返回一个json文件(ist类型的对象)
In [3]: friends = itchat.get_friends(update=True)[0:]
In [4]: type(friends)
Out[4]: list
#可以看到列表里的好友的后台数据到底是什么样的,由哪些参数组成。比如:用户名编码"UserName",所在城市"City",签名"Signature"等等
In [5]: friends[0]
Out[5]: <User: {'MemberList': <ContactList: []>, 'UserName': '@c8d6ab878e7f20fb36a1f0857e696b12', 'City': '红河', 'DisplayName': '', 'PYQuanPin': 'zuotianhonghejinchengwu', 'RemarkPYInitial': '', 'Province': '云南', 'KeyWord': 'gzh', 'RemarkName': '', 'PYInitial': 'ZTHHJCW', 'EncryChatRoomId': '', 'Alias': '', 'Signature': '哪有这么多话要说', 'NickName': '昨天红河金城武', 'RemarkPYQuanPin': '', 'HeadImgUrl': '/cgi-bin/mmwebwx-bin/webwxgeticon?seq=686562308&username=@c8d6ab878e7f20fb36a1f0857e696b12&skey=@crypt_8c1d3ee7_674d0608e493556548829100fd5c9b69', 'UniFriend': 0, 'Sex': 1, 'AppAccountFlag': 0, 'VerifyFlag': 0, 'ChatRoomId': 0, 'HideInputBarFlag': 0, 'AttrStatus': 102439,
用Python玩Wechat
最新推荐文章于 2025-06-17 19:03:33 发布