plugin.video.bdyun icon indicating copy to clipboard operation
plugin.video.bdyun copied to clipboard

0.1.14版插件 获取cookie参数不全,导致没多长时间就失效

Open Realmyname opened this issue 7 years ago • 2 comments

只能获取:PANPSC、PTOKEN、cflag、BDUSS、USERNAMETYPE、PANWEB、BAIDUID、PASSID、SAVEUSERID、STOKEN、UBI、HISTORY

少了 SCRC

问题出在auth.py 277行 def get_bdstoken 中requests.get直接获取的是最终跳转,但是中间的跳转也setcookie了。 我的解决办法

req = requests.head(url, allow_redirects=False,headers=headers_merged, cookies=temp_cookie, timeout=50, verify=False) req.encoding = 'utf-8' if req: while 'Location' in req.headers.keys(): if 'Set-Cookie' in req.headers.keys(): _cookie = req.headers['Set-Cookie'] key = ['STOKEN', 'SCRC', 'PANPSC'] auth_cookie = add_cookie(temp_cookie, _cookie, key) rr = req.headers['Location'] if 'http' not in rr: rr = 'https://pan.baidu.com'+rr req = requests.head(rr, allow_redirects=False,headers=headers_merged, cookies=temp_cookie, timeout=50, verify=False) req.encoding = 'utf-8' req = requests.get(rr, headers=headers_merged, cookies=temp_cookie, timeout=50, verify=False) req.encoding = 'utf-8' return (auth_cookie, parse_bdstoken(req.text))

Realmyname avatar Oct 21 '17 09:10 Realmyname

请你提交一个pr 我正准备添加二维码登录。这两个可以同步进行

caasiu avatar Oct 22 '17 13:10 caasiu

@Realmyname 你好,帮忙提供 def get_bdstoken 的完整代码,我是菜鸟,具体不是很清楚是要改哪些代码,谢谢

kylewuwu avatar Dec 03 '17 09:12 kylewuwu