-
Notifications
You must be signed in to change notification settings - Fork 16
Description
只能获取: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))