Comments (5)
找到问题在哪了,获取 ptwebqq
必须通过请求确定登录状态的接口返回的链接再从 cookies
里面取,不能直接不请求就直接 cookies
里面取,很感谢,给的博客资料很详细。THX!
from qqbot.
您好,关于 smartQQ 协议的细节,您可以参考下 ScienJus 的博客,写的非常深入细致:
http://www.scienjus.com/webqq-analysis-1/
关于 retcode 的含义,参考 ScienJus 的分析:
- 保证请求头中包含正常的User-Agent、Referer、Cookie等信息,如果是Post请求需要额外加上Origin
在大部分情况下(除了获取二维码和确认二维码状态),返回内容均为JSON,其中retcode为请求结果(0为成功),response为返回数据 - 不过还有个特例是发送消息的接口,成功时返回的字段是errCode,失败时才是retcode
- 请求失败后,返回的错误码如果是1000000或1000001,几乎可以认为是缺少了第一条中的某个数据
- 如果请求参数中有t,当前版本不会检验它的值,所以我统一设为0.1,但是实际上它的值一般情况下均为当前时间的unix timestamp
- 如果返回的返回的错误码为1000003,很有可能是你的请求频率过于频繁
你这里返回的是 100000 ,有可能是请求的 header 缺少了 User-Agent、Referer、Cookie 或 Origin 等信息,也有可能是请求的 url 没写对。你可以把你的代码也发一下。
from qqbot.
感谢回复。
这是请求的地址,头信息,和返回的 retcode。
下面这是 cookies,
t
参数是用random.random()
生成,请求直接main.session.get(url, headers=headers)
上面提到的headers都添加了,但是还是不太清楚为什么。
THX。
from qqbot.
好像没什么问题,你改成下面这个试试:
main.session.headers.update(**headers)
main.session.get(url)
from qqbot.
或者改成:
main.session.headers.update({
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Referer': 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',
'Origin': 'http://s.web2.qq.com'
})
resp = main.session.get(
'http://s.web2.qq.com/api/getvfwebqq?ptwebqq=%s&clientid=%s&psessionid=&t=%s' % (ptwebqq, clientid, repr(random.random())
)
from qqbot.
Related Issues (20)
- 获取不了入群时间和最后发言时间 HOT 1
- 现在还有禁言功能吗 HOT 1
- urllib2 python3没有了,要用urllib.request代替
- 邮箱配合 http 使用二维码有一些设定问题 HOT 3
- 获取群列表失败 HOT 16
- 近期总是这样卡住 HOT 1
- 登录信息过期,邮箱没收到新的二维码 HOT 2
- 邮箱收不到验证码 HOT 3
- bug report HOT 7
- 是否可以设置不接收群消息 HOT 1
- bot.send接口有较大可能卡顿30秒 HOT 3
- 服务器模式URL得要怎么输出返回或者发给POST之类的 HOT 2
- Smart QQ将于2019年1月1日停止服务??? HOT 42
- 做成服务器扫描的那种形式 如果多个QQ号在服务器上登录 因为ip都是用服务器ip 多个QQ号在同一个ip上登录被禁封怎么办 能不能加一个类似shadowsocks端口转发的选项或者插件 在用户那里安装一个shadowsock客户端 然后服务器这边以用户的ip操作他的那个QQBOT!!! 求解 HOT 1
- 请问一个或许与技术无关的问题,腾讯smartqq关闭服务后,是不是机器人就无法使用了? HOT 5
- Just suggest users to use other framework to devlop qq robot.
- [CRITICAL] QQBOT 异常停止(code=1)
- why stop? HOT 1
- qqbot 已无法使用,可使用 js-bot 替代
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qqbot.