本帖最后由 europe007 于 2022-9-19 09:43 编辑
[Python] 纯文本查看 复制代码 import requests
session = requests.session()
url = 'https://pan.baidu.com/share/set'
if(not False):
pwd = 1123
form_data = {
'schannel': 4,
'channel_list': '[]',
'period': 7,
'pwd': pwd,
'fid_list': str([123456]),
}
headers = {
"Accept":"*/*" ,
"Accept-Encoding":"gzip, deflate, br" ,
"Accept-Language":"zh-CN,zh;q=0.9" ,
"Cache-Control":"no-cache" ,
"Connection":"keep-alive" ,
"Content-Length":"79" ,
"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8" ,
"Cookie":"我的cookie值" ,
"Host":"pan.baidu.com" ,
"Origin":"https://pan.baidu.com" ,
"Pragma":"no-cache" ,
"Referer":"https://pan.baidu.com/disk/home?" ,
"Sec-Fetch-Dest":"empty" ,
"Sec-Fetch-Mode":"cors" ,
"Sec-Fetch-Site":"same-origin" ,
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36" ,
"X-Requested-With":"XMLHttpRequest"
}
responses = session.post(url, headers=headers, data=form_data)
print(responses.headers)
if(responses.json()['errno'] == 0):
print({'errno': 0, 'err_msg': '创建分享链接成功!', 'info': {'link': responses.json()['link'], 'pwd': pwd}})
else:
print( {'errno': 1, 'err_msg': '创建分享链接失败!', 'info': responses.json()}) |