蓝奏云直链解析API网址:
https://api.xinac.net/lanzous?url=https://www.lanzoui.com/i3xcmaf
本教程基于Python开发
参数url
为下载页面网址,如:https://www.lanzoui.com/i3xcmaf
def parse_1(url):
print('---> 原始网址:', url)
header = headers.get_header(referer=url)
req = request.Request(url=url, headers=header, method='GET')
response = request.urlopen(req, timeout=30)
resp = response.read().decode('utf-8', 'ignore')
bs = bs4.BeautifulSoup(resp, features='lxml')
if bs:
bs2 = bs.find_all("iframe")
if bs2:
print(src)
return bs2[0].get('src')
return None
参数:https://www.lanzoui.com/i3xcmaf
返回:/fn?UDYBa1o_aAmUFYQNnUzNVYVA_aVXYAKwM8UmRbaABlW24CNFE1AW0EZFU3Cmk_c
参数为https://www.lanzoui.com
加parse_1
的返回值
def parse_2(url):
header = headers.get_header(referer=url)
req = request.Request(url=url, headers=header, method='GET')
response = request.urlopen(req, timeout=30)
resp = response.read().decode('utf-8', 'ignore')
ajax_sign = re.findall(r'var ajaxdata = \'([\w]+?)\';', resp)
data = dict()
data['action'] = 'downprocess'
data['sign'] = ajax_sign[0]
data['ves'] = 1
print(data)
return data
参数:https://www.lanzoui.com/fn?UDYBa1o_aAmUFYQNnUzNVYVA_aVXYAKwM8UmRbaABlW24CNFE1AW0EZFU3Cmk_c
返回:{'action': 'downprocess', 'sign': 'B2EHOV5vATAIAVZpBjYCPgFjDjhRPAc3ATJWZVY_aBiFTJwBqDWFSMwdoUTMKaAAyAGpXa1U6ADU_c', 'ves': 1}
此处有3个参数:
https://www.lanzoui.com/ajaxm.php
parse_2
的参数url
parse_2
的返回值得到的网址非最终链接。
def parse_3(url, referer, data):
print(url)
header = headers.get_header(referer=referer)
resp = requests.post(url, headers=header, data=data)
text = json.loads(resp.content)
if text and text['zt'] == 1:
href = text['dom'] + '/file/' + text['url']
print(href)
return href
return None
参数:
1. https://www.lanzoui.com/ajaxm.php
2. https://www.lanzoui.com/fn?UDYBa1o_aAmUFYQNnUzNVYVA_aVXYAKwM8UmRbaABlW24CNFE1AW0EZFU3Cmk_c
3. {'action': 'downprocess', 'sign': 'B2EHOV5vATAIAVZpBjYCPgFjDjhRPAc3ATJWZVY_aBiFTJwBqDWFSMwdoUTMKaAAyAGpXa1U6ADU_c', 'ves': 1}
返回:https://vip.d0.baidupan.com/file/?AGYCPFloAjNUXQM7BTACblBvUmoFs1bNUt0H6FaRBK8F4ADQXZ1SJglyAnQLuFftVrMH6lGHBrYCK1U+XXFQYgAmAjNZbQI6VGcDCgU4AmdQN1JvBWlWZlJnBzVWPwQwBSMAMV1zUjsJbgJkC2dXb1Y5BzpROwYyAiNVI11xUGwAMgJlWTUCb1QtA2UFZQIsUDhSYAV1VjZSYQdkVj8EMQU0AGFdN1IwCW4CZAtuVzdWPwc3UWoGMAI9VWddY1BkADcCZVlhAjVUMQM3BWkCZ1A5UmMFblZ6UjgHcVY5BCMFcAAkXWVSdAk2AjALYlduVjsHNlE9BjICM1V1XXVQOABtAjBZYgJrVDMDYAVoAjdQPFJkBWtWbFJhBzZWJAQrBSMAMV1sUnEJYgJlC2pXb1Y4BzRRPAY9AjdVY10xUHcAdQIlWXMCa1QzA2AFZAI1UDhSbgVvVm1SbQc5ViwEcAVsACddPVI1CWYCegtuV2NWOQcsUTwGNQIwVX1dOFBl
参数url
为parse_3
的返回值
def parse_4(url):
print(url)
header = headers.get_header(lang='zh-CN,zh;q=0.9,en;q=0.8')
resp = requests.head(url, headers=header)
head = resp.headers
if resp.status_code == 301 or resp.status_code == 302:
print(head['Location'])
return head['Location']
else:
print('---> error: ', resp.status_code)
return None
返回:https://developer56.baidupan.com/071317bb/2019/04/27/b4e541676101a35d484b570ec3b8d344.mp3?st=0T1UeKCZgcchvgRVjfbRbA&e=1594632848&b=CbIAmVDYWbVQnlerBrMFhgLKCXUEKFB2U_bcIvlzkUrgF3gy_bV3kFbVRxUTQ_c&fi=8322455&pid=43-224-47-206&up=
跳转
并下载文件下载链接
,不需要浏览器跳转时间戳
等参数,有效期3分钟
失效
本文由 新逸Cary 创作,如果您觉得本文不错,请随意赞赏
采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
原文链接:https://blog.xinac.cn/archives/api-lanzous.html
最后更新:2020-11-25 16:48:14
Update your browser to view this website correctly. Update my browser now