-
-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
知乎需要手机验证码 #36
Comments
您好 请问有办法或其他工具解决这个问题吗?头疼 |
可以手动解决,网页上登录以后在local storage里面把cookie复制出来 |
您好 获取的cookie应该加到哪里呢?新手入门 |
我用的 zhihu_oauth 这个包,给你一段代码参考一下吧 from zhihu_oauth import ZhihuClient, Answer
from zhihu_oauth.oauth.token import ZhihuToken
ZhihuToken.from_dict(zhihu_config['token_json']).save(zhihu_config['token_file'])
client = ZhihuClient()
if os.path.isfile(zhihu_config['token_file']):
client.load_token(zhihu_config['token_file']) token_json 长这样 {
"user_id": 1111111111111111111,
"uid": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"access_token": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"lock_in": 1800,
"expires_in": 15000000,
"token_type": "bearer",
"cookie": {
"q_c0": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"z_c0": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"unlock_ticket": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"refresh_token": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
} 下面是我写的一段文档供参考: 如果提示需要手机登录,则电脑上打开知乎网页,按F12然后在调试窗口的console页中输入下方代码并回车,返回 undefined 即为成功。 window.addEventListener("beforeunload", function() { debugger; }, false) 接着打开调试窗口的network页,点击clear按钮清除所有记录。 接着在网页上用手机登录,登录后会触发调试窗口暂停,在 network 页中找到 sign_in 条目, 这个请求的body是加密的,暂时没找到自动发请求的方法,得手动复制。 |
加密方法估计和 https://github.com/CharlesPikachu/DecryptLogin/blob/master/DecryptLogin/platforms/zhihu.py 是一样的,但是目前没时间研究了,如果有人解决了希望能共享一下。 |
非常谢谢您的回答!非常用心的回答,帮助很大! |
晚上我会publish DecryptLogin v0.2,里面支持知乎的扫码登录,这样就不需要每次复制cookies了。(因为后续再升级版本的话想在mode里直接加入短信验证码登录功能,所以暂时没去解决账号安全需要短信验证这个问题,新版本会临时disable pc端用账号密码登录知乎) |
new version is published, so I closed this issue. feel free to reopen this issue if you have any questions about this issue again. |
登录时返回:{'error': {'message': '为了您的帐号安全,请使用短信验证码登录', 'code': 120017}}
The text was updated successfully, but these errors were encountered: