def
get_level_two(parameter):
print
(f
'下载地址解析中,需等待2-5秒'
)
headers
=
{
'Connection'
:
'keep-alive'
,
'Content-Length'
:
'264'
,
'sec-ch-ua'
:
'"Microsoft Edge";v="107", "Chromium";v="107","Not=A?Brand";v="24"'
,
'Accept'
:
'*/*'
,
'Content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
'X-Requested-With'
:
'XMLHttpRequest'
,
'sec-ch-ua-mobile'
:
'?0'
,
'User-Agent'
:
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35'
,
'sec-ch-ua-platform'
:
'"Windows"'
,
'Sec-Fetch-Site'
:
'same-origin'
,
'Sec-Fetch-Mode'
:
'cors'
,
'Sec-Fetch-Dest'
:
'empty'
,
'Accept-Encoding'
:
'gzip, deflate, br'
,
'Accept-Language'
:
'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,en-GB-oxendict;q=0.5'
,
'Cookie'
:
'session_prefix=a5a4be6cf29eaac32b0c2aa55750daa7; Hm_lvt_f749697bf30790443314f1111033dc5c=1667395320,1667737450,1667818866,1667870341'
,
}
downfile
=
{
'fs_id'
: parameter[
0
].replace(
, ''),
'timestamp'
: parameter[
2
].replace(
, ''),
'share_id'
: parameter[
4
].replace(
, ''),
'filesize'
: parameter[
6
].replace(
, ''),
'md5'
: parameter[
8
].replace(
"'"
, ''),
}
response
=
requests.post(ask_download, headers
=
headers, data
=
downfile)
root
=
etree.HTML(response.text)
params
=
root.xpath(
'//div[@class="q-topic-item"]/div/a[1]/@href'
)
if
params:
href
=
params[
0
].replace(
"javascript:file_url_copy('"
, '
').replace("'
)", '')
else
:
href
=
'提取失败!'
print
(f
'下载地址:{href}'
)