Giter Site home page Giter Site logo

wxbot's Issues

微信群的 @

r'@.+?\u2005'
群中@后面还有一个不可见字符 \u2005,

os.startfile

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

会莫名其妙的死掉

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: 变更联系人列表

没有自动打开二维码图片文件 qr.png

环境

  • Mac os 10.10.5
  • Chrome 48.0.2564.116
  • Python 2.7.9

问题

运行python test.py,没有自动打开二维码图片文件 qr.png。

建议解决方案

Pillow代替webbrowser实现自动打开,可以跨平台。

  • 安装

$ pip install Pillow

  • 使用
from PIL import Image

img = Image.open(qr_file_path)
img.show()

win 10 下运行不了

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',

run test.py有问题

出现这个错误,是怎么回事requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)

[bug] Except in proc_msg

[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)

运行出错

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://?

经常卡死的问题

我使用一段时间感觉经常会出现卡死,我觉得可能是因为图灵机器人发了一些无法处理的东西,比如之间问他天气,就会导致程序卡住,代码里面是不是没有处理这方面的信息所以导致程序卡死了

登录成功初始化失败

初始化的地址是:https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?r=1458554541&lang=en_US&pass_ticket=jpjBfpQ%2BhSB1I7MFQWs29AJCKNUQBQnGTXTVSsl%2BvoLGddrngaxPSHEeB5d%2BAn5H

请求参数如下:
"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请求的原因吗?

test.py可正常运行,但修改hi为中文后就不行了

如题
修改中文后,用其它账户发送消息给我扫码登录的账户就是:
[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_url(msg_id)

        msg_content['data'] = self.get_voice(msg_id)

还是不行

Python没有函数重载,请问这句是谁写的????

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

@liuwons

DEBUG信息不准确

当发送消息的账号既是自己的微信好友又是群聊成员时,后台显示的DEBUG信息中消息发送者可能会显示为该账号的群名片。

您好,请问你有语音发送的接口么

我们要做一个多群直播,其余的基本都按照您的代码或者研究成果用nodejs实现了,但是没有语音发送的接口,从webwx保存的源码里也没有这个接口,如果您知道的话方便告诉我么,有实现的方式或者可以知道提示的链接也可以,谢谢

test.py问题

还是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 .

聊天中出现非"gbk"的字符会强制退出

聊天中出现非"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 拼写错误.

mtype==47,原创表情符容错

mtype==47,原创表情符虽命中Animation,但微信给的message content为空导致后面self.search_content('cdnurl', content),schema被带入unknown,继而main crash,此处需要容错。

[ERROR] This user does not exist .

为什么我扫了二维码之后提示 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 .

有错误,user)id属性找不到

[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'

发送语音消息

想实现发送语音消息功能,或者转发语音,请问有相关接口吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.