Skip to content

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

@Realmyname

Description

@Realmyname

只能获取: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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions