Comments (8)
我用的 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 条目,
选中后从 response 中把内容复制出来,粘贴到 config.json 的 token_json 中覆盖原条目。
这个请求的body是加密的,暂时没找到自动发请求的方法,得手动复制。
from decryptlogin.
您好 请问有办法或其他工具解决这个问题吗?头疼
from decryptlogin.
可以手动解决,网页上登录以后在local storage里面把cookie复制出来
from decryptlogin.
您好 获取的cookie应该加到哪里呢?新手入门
from decryptlogin.
加密方法估计和 https://github.com/CharlesPikachu/DecryptLogin/blob/master/DecryptLogin/platforms/zhihu.py 是一样的,但是目前没时间研究了,如果有人解决了希望能共享一下。
from decryptlogin.
非常谢谢您的回答!非常用心的回答,帮助很大!
from decryptlogin.
晚上我会publish DecryptLogin v0.2,里面支持知乎的扫码登录,这样就不需要每次复制cookies了。(因为后续再升级版本的话想在mode里直接加入短信验证码登录功能,所以暂时没去解决账号安全需要短信验证这个问题,新版本会临时disable pc端用账号密码登录知乎)
另外一个解决方案就是绑定邮箱,用邮箱+密码登录~
from decryptlogin.
new version is published, so I closed this issue.
feel free to reopen this issue if you have any questions about this issue again.
from decryptlogin.
Related Issues (20)
- taobao Fail to login, your account requires security verification
- 购买商品响应值不正确,tb封了吗 HOT 4
- 淘宝抢购,提交订单触发淘宝滑动验证码怎嘛破 HOT 1
- 淘宝抢购-扫码登录-日志提示登录成功-但实际没有成功登录 HOT 1
- [Question] 请教关于session有效期的问题 HOT 9
- 请问可以指定pkl文件的位置吗 HOT 3
- [BUG]京东模拟登录失效 HOT 1
- 知乎未出现输入验证码界面 HOT 1
- [BUG]
- 请问网易云音乐的接口失效了吗? HOT 2
- [Taobao 启用脚本才能显示当前页面] HOT 1
- [Question] 用在zhihu.py521行 execjs执行Javascript的时候报execjs._exceptions.ProgramError: SyntaxError: Expected identifier HOT 2
- 网易云音乐登陆总是显示RuntimeError: 网络太拥挤,请稍候再试。 HOT 2
- [BUG]京东二维码登陆调用报错 HOT 2
- [BUG]无法登陆知乎 HOT 1
- 微博监控时遇到问题
- Unable to login to twitter
- [BUG]知乎的scanqr模式不能登录 HOT 1
- 百度贴吧扫码登陆报错
- [BUG]推特登录全部失效
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 decryptlogin.