有人做过模拟微信登录吗,登陆成功无法获取到好友列表 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
vincenth520
V2EX    Python

有人做过模拟微信登录吗,登陆成功无法获取到好友列表

  •  
  •   vincenth520
    vincenth520 2017-08-21 17:19:29 +08:00 5692 次点击
    这是一个创建于 3022 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如题,登录发送消息什么的都能实现,但是就是获取不到好友列表,我也看了好几个 github 模拟登陆的,发现他们代码里面都有一个这个代码,不清楚什么作用,想问问是不是这个问题导致的

    https://github.com/littlecodersh/ItChat/blob/bbcb8173b611137a6fd6ac8a4d0a96cb8892fbd6/itchat/components/login.py#L157

    for indexUrl, detailedUrl in ( ("wx2.qq.com" , ("file.wx2.qq.com", "webpush.wx2.qq.com")), ("wx8.qq.com" , ("file.wx8.qq.com", "webpush.wx8.qq.com")), ("qq.com" , ("file.wx.qq.com", "webpush.wx.qq.com")), ("web2.wechat.com" , ("file.web2.wechat.com", "webpush.web2.wechat.com")), ("wechat.com" , ("file.web.wechat.com", "webpush.web.wechat.com"))): fileUrl, syncUrl = ['https://%s/cgi-bin/mmwebwx-bin' % url for url in detailedUrl] if indexUrl in core.loginInfo['url']: core.loginInfo['fileUrl'], core.loginInfo['syncUrl'] = \ fileUrl, syncUrl break 

    https://github.com/0x5e/wechat-deleted-friends/blob/b37f324f9a4df68c3799da5b7dc2559921293e9b/wdf.py#L151

     # push_uri 与 base_uri 对应关系(排名分先后)(就是这么奇葩..) services = [ ('wx2.qq.com', 'webpush2.weixin.qq.com'), ('qq.com', 'webpush.weixin.qq.com'), ('web1.wechat.com', 'webpush1.wechat.com'), ('web2.wechat.com', 'webpush2.wechat.com'), ('wechat.com', 'webpush.wechat.com'), ('web1.wechatapp.com', 'webpush1.wechatapp.com'), ] push_uri = base_uri for (searchUrl, pushUrl) in services: if base_uri.find(searchUrl) >= 0: push_uri = 'https://%s/cgi-bin/mmwebwx-bin' % pushUrl break 

    这两处代码有什么作用呢

    第 1 条附言    2017-08-22 10:09:16 +08:00
    已经找到问题了,原来是 cookie 没处理好。。。但是居然能够发消息。。。真神奇
    4 条回复    2017-08-22 21:30:07 +08:00
    lsido
        1
    lsido  
       2017-08-21 23:36:16 +08:00
    itchat 里有个 get_friends 方法用于获取好友列表

    itchat.get_friends()

    没有看源码吗,还是研究一下
    caspartse
        2
    caspartse  
       2017-08-22 06:21:31 +08:00
    通讯录的接口应该是 https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetcontact。
    早前写了个简单的通讯录导出工具,好像还能用,可以参考下 http://kagent.applinzi.com/wx
    vincenth520
        3
    vincenth520  
    OP
       2017-08-22 09:04:07 +08:00
    @lsido 看了,很神奇,其他都没问题,就是获取好友为空
    lsido
        4
    lsido  
       2017-08-22 21:30:07 +08:00
    @vincenth520 用 get_friends 方法也是空? 调试一下看看
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2588 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 24ms UTC 03:05 PVG 11:05 LAX 19:05 JFK 22:05
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86