liuwons / wxbot Goto Github PK
View Code? Open in Web Editor NEWDeprecated
License: Apache License 2.0
Deprecated
License: Apache License 2.0
r'@.+?\u2005'
群中@后面还有一个不可见字符 \u2005,
On Mac OS, there is no os.startfile, without it, the wxbot can not start at all.
Please revert to the preview version about startfile, or find a better way
f.write(r.text.encode('utf-8'))
TypeError: write() argument must be str, not bytes
弹出这个。。。这不就是已经是用 .encode 转过的 str
了吗?
Traceback (most recent call last):
File "bot.py", line 118, in <module>
main()
File "bot.py", line 114, in main
bot.run()
File "C:\Users\XXXXX\Desktop\wxBot-python3\wxbot.py", line 561, in run
self.proc_msg()
File "C:\Users\XXXXX\Desktop\wxBot-python3\wxbot.py", line 466, in proc_msg
time.sleep(0.5 - check_time)
KeyboardInterrupt
WXBot.group_members
里面没有用户头像的URL,如果直接去把group_members
里面的UserName
扔进WXBot.get_icon
方法的话有很大比例加载不了头像(HTTP状态码是200,但是响应正文长度是0)。
观察了一下微信网页版的群聊界面,发现头像的URL后面有一个chatroomid
参数,但是不知道怎么获取。
群联系人更新会反映在 webwxsync 的:
ModContactCount: 变更联系人数目
ModContactList: 变更联系人列表
运行python test.py
,没有自动打开二维码图片文件 qr.png。
用Pillow
代替webbrowser
实现自动打开,可以跨平台。
$ pip install Pillow
from PIL import Image
img = Image.open(qr_file_path)
img.show()
Traceback (most recent call last):
File "test.py", line 4, in <module>
from wxbot import *
File "C:\Users\XXXX\Desktop\wxBot-0.1\wxbot.py", line 285
print ' %s[Location] %s ' % (msg_prefix, pos)
1,group uid直接获取已经被wxc5s23sc.js用实时key加密了,用wxBot类从contact中暴力获取@@,已经取不到为空。不妨伪造群消息获取最新的group uid,这样按需获取容易避开微信风控,否则容易被CD。
2,个人给群发消息不妨归为msg_type_id===3,但是紧接着碰到这段疑问
sp = content.find('
')
uid = content[:sp]
content = content[sp:]
content = content.replace('
', '')
区别在于:
其他人给群发消息
u'Content': u'@d85a4205309f32ed50d562b80215cd98140a613ee59ccfd92cc2b14b947912a6:
oo',
自己给给群发消息
u'Content': u'Cv',
但为了甄别真正的消息源,可以再考虑复用这种情况下的
u'FromUserName': u'@069b65f4ceaba06ed3ff75663da82b7bb5e266c0d86053548cf03bc64b867f3c',
Linux终端如何显示图片
出现这个错误,是怎么回事requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
提了一个增加推出功能的requests
[ERROR] Except in proc_msg
Traceback (most recent call last):
File "/home/liuyang/wall/weixin/wxbot2/lib/wxbot.py", line 613, in proc_msg
self.handle_msg(r)
File "/home/liuyang/wall/weixin/wxbot2/lib/wxbot.py", line 583, in handle_msg
content = self.extract_msg_content(msg_type_id, msg)
File "/home/liuyang/wall/weixin/wxbot2/lib/wxbot.py", line 416, in extract_msg_content
name = self.get_group_member_prefer_name(self.get_group_member_name(uid, msg['FromUserName']))
TypeError: get_group_member_name() takes exactly 2 arguments (3 given)
如题,我微信15359446863,朋友们一起交流
mac os 10.11.3
> python -V
Python 2.7.10
> python wxBot/test.py
[INFO] Please use WeCaht to scan the QR code .
[ERROR] WeChat login timeout .
[INFO] Please confirm to login .
23
[ERROR] WeChat login timeout .
Traceback (most recent call last):
File "wxBot/test.py", line 28, in <module>
main()
File "wxBot/test.py", line 24, in main
bot.run()
File "/Users/keeley/Documents/github/wxBot/wxbot.py", line 528, in run
if self.login():
File "/Users/keeley/Documents/github/wxBot/wxbot.py", line 596, in login
r = self.session.get(self.redirect_uri)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 454, in request
prep = self.prepare_request(req)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 388, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/Library/Python/2.7/site-packages/requests/models.py", line 293, in prepare
self.prepare_url(url, params)
File "/Library/Python/2.7/site-packages/requests/models.py", line 353, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '': No schema supplied. Perhaps you meant http://?
我使用一段时间感觉经常会出现卡死,我觉得可能是因为图灵机器人发了一些无法处理的东西,比如之间问他天气,就会导致程序卡住,代码里面是不是没有处理这方面的信息所以导致程序卡死了
请求参数如下:
"BaseRequest" -> "{"DeviceID":"e928816667635154","Uin":"2051992284","Skey":"@crypt_a626cc56_f9e3769fd62f6d2221de3348d5803836","Sid":"DB1J8QJiR+DmVJVh"}"
返回信息如下:
{"BaseResponse": {"Ret": 1,"ErrMsg": ""},"Count": 0,"ContactList": [],"SyncKey": {"Count": 0,"List": []},"User": {"Uin": 0,"UserName": "","NickName": "","HeadImgUrl": "","RemarkName": "","PYInitial": "","PYQuanPin": "","RemarkPYInitial": "","RemarkPYQuanPin": "","HideInputBarFlag": 0,"StarFriend": 0,"Sex": 0,"Signature": "","AppAccountFlag": 0,"VerifyFlag": 0,"ContactFlag": 0,"WebWxPluginSwitch": 0,"HeadImgFlag": 0,"SnsFlag": 0},"ChatSet": "","SKey": "","ClientVersion": 0,"SystemTime": 0,"GrayScale": 0,"InviteStartCount": 0,"MPSubscribeMsgCount": 0,"MPSubscribeMsgList": [],"ClickReportInterval": 0}
初始化失败,请问是什么原因呢, 是我post请求的原因吗?
如题,谢谢
window.synccheck={retcode:"0",selector:"0"}
在手机上@就有回应,但是在电脑版微信上@就完全不能识别了。
如题
修改中文后,用其它账户发送消息给我扫码登录的账户就是:
[INFO] Please use WeChat to scan the QR code .
[INFO] Please confirm to login .
[INFO] Web WeChat login succeed .
[INFO] Web WeChat init succeed .
[INFO] Get 176 contacts
[INFO] Start to process messages .
[MSG] ******_:
[Text] 归
Traceback (most recent call last):
File "test_1.py", line 28, in
main()
File "test_1.py", line 24, in main
bot.run()
File "/git/my/wxBot/wxbot.py", line 718, in run
self.proc_msg()
File "/git/my/wxBot/wxbot.py", line 605, in proc_msg
self.handle_msg(r)
File "/git/my/wxBot/wxbot.py", line 581, in handle_msg
self.handle_msg_all(message)
File "test_1.py", line 10, in handle_msg_all
self.send_msg_by_uid('哈哈', msg['user']['id'])
File "/git/my/wxBot/wxbot.py", line 636, in send_msg_by_uid
data = json.dumps(params, ensure_ascii=False).encode('utf8')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 250, in dumps
sort_keys=sort_keys, *_kw).encode(obj)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 210, in encode
return ''.join(chunks)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 1: ordinal not in range(128)
单条消息还没看,至少群消息里的换行找不到,但原生微信对话框里是有的。
别的都没问题,就grouplist不全,而且反复调用get_contact()也没有获得更多
还是扫过之后一直有效?
求大神指点一下,如果才能实现红包提醒功能,即 可以知道在群里是谁发的红包。
文档说支持图片和语音,我修改了下代码测试发现,发出来的是url;
后来修改了
msg_content['data'] = self.get_voice(msg_id)
还是不行
想一直保持在后台运行
sry
def get_group_member_info(self, uid):
if uid in self.account_info['group_member']:
return self.account_info['group_member'][uid]
else:
return None
def get_group_member_info(self, uid, gid):
if gid not in self.group_members:
return None
for member in self.group_members[gid]:
if member['UserName'] == uid:
return {'type': 'group_member', 'info': member}
return None
发送退下关闭等指令 关闭不了自动回复,是怎么个情况
要怎么才能显示群的名称
rt
当发送消息的账号既是自己的微信好友又是群聊成员时,后台显示的DEBUG信息中消息发送者可能会显示为该账号的群名片。
log如下:
INFO] Please use WeCaht to scan the QR code .
[ERROR] WeChat login timeout .
[INFO] Please confirm to login .
[ERROR] WeChat login timeout .
[ERROR] Login failed due to network problem, please try again.
[ERROR] Web WeChat login failed .
是否是我的操作不正确吗?
没找到方法
我们要做一个多群直播,其余的基本都按照您的代码或者研究成果用nodejs实现了,但是没有语音发送的接口,从webwx保存的源码里也没有这个接口,如果您知道的话方便告诉我么,有实现的方式或者可以知道提示的链接也可以,谢谢
还是test.py中 修改用户tb为 我的好友名称后报错如下
[INFO] Please use WeChat to scan the QR code .
[INFO] Web WeChat login succeed .
[INFO] Web WeChat init succeed .
[INFO] Get 176 contacts
[INFO] Start to process messages .
/git/my/wxBot-master-dev/wxbot.py:644: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if 'RemarkName' in contact and contact['RemarkName'] == name:
/git/my/wxBot-master-dev/wxbot.py:646: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
elif 'NickName' in contact and contact['NickName'] == name:
/git/my/wxBot-master-dev/wxbot.py:648: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
elif 'DisplayName' in contact and contact['DisplayName'] == name:
[ERROR] This user does not exist .
[ERROR] This user does not exist .
send_msg 或 send_msg_by_uid 能否对指定的群发送消息? 有没有实现的办法?
聊天中出现非"gbk"的字符会强制退出
如mujie的 出租车或者前段时间很火的"/u202e"都会这样
在反应一个问题就是如果中途断网几秒钟的话,不会重连
'''
[INFO] Please use WeCaht to scan the QR code .
[INFO] Please confirm to login .
[INFO] Web WeChat login succeed .
[INFO] Web WeChat init succeed .
[INFO] Get 1333 contacts
[INFO] Start to process messages .
21:27 Yixuan@Yixuans-MacBook-Pro /Users/Yixuan/Desktop/wxBot
'''
我的系统是Mac OS X 10.11.1. 所有的依赖包都确定安装无误.
Test 了项目中的 Python 文件,
发现, wxbot.py
无反应.
test.py
成功, 显示代码如上, 但会直接退出.
bot.py
已经去图灵申请了 key, 并新建了 conf.ini 文件, 放入 Key, 测试结果同上. 有反应. 也会显示联系人, 但说完 start to process messages 就直接退出了.
还有第一行的 " Please use WeCaht to scan the QR code ."
WeChat 拼写错误.
RT
mtype==47,原创表情符虽命中Animation,但微信给的message content为空导致后面self.search_content('cdnurl', content),schema被带入unknown,继而main crash,此处需要容错。
为什么我扫了二维码之后提示 This user does not exist
[INFO] Please use WeCaht to scan QR code in qr.jpg .
[INFO] Please confirm to login .
[INFO] Web WeChat login succeed .
[INFO] Web WeChat init succeed .
[INFO] Get 448 contacts
[INFO] Start to process messages .
[ERROR] This user does not exist .
[INFO] Start to process messages . Traceback (most recent call last): File "D:\Temp\workspace\pythonTest\src\com\dscao\test1\weixin.py", line 20, in <module> main() File "D:\Temp\workspace\pythonTest\src\com\dscao\test1\weixin.py", line 17, in main bot.run() File "D:\Temp\workspace\pythonTest\src\com\dscao\test1\wxbot.py", line 545, in run self.proc_msg() File "D:\Temp\workspace\pythonTest\src\com\dscao\test1\wxbot.py", line 457, in proc_msg self.schedule() File "D:\Temp\workspace\pythonTest\src\com\dscao\test1\weixin.py", line 11, in schedule self.send_msg('tb', 'schedule') File "D:\Temp\workspace\pythonTest\src\com\dscao\test1\wxbot.py", line 488, in send_msg uid = self.get_user_id(name) AttributeError: MyWXBot instance has no attribute 'get_user_id'
我看 content 你处理了 ‘<>’,似乎昵称没处理。
需要 html.unescape(nickname)
想实现发送语音消息功能,或者转发语音,请问有相关接口吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.