嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
本实例通过一个作品的分享地址解析并且下载MP4格式的文件
import requests
requests.packages.urllib3.disable_warnings()
def parseGifShow(url_gifshow):
mHEADERS = {
'Accept': 'text/html,application/xhtml xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'Cache-control': 'max-age=0',
'Cookie': 'did=web_01432c94744541a5a45479f8e2c1d175;',
'Host': 'm.gifshow.com',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1',
'Upgrade-Insecure-Requests': '1',
'User-Agent': "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
}
res = requests.get(url_gifshow, headers=mHEADERS, allow_redirects=False)
longUrl = res.headers['Location']
res = requests.get(longUrl, headers=mHEADERS, allow_redirects=False)
video_title = res.text.split(","share":{"title":"")[1].split("","")[0]
videoUrl = res.text.split("srcNoMark")[2].split(".mp4")[0].replace("":"", "") ".mp4"
return '{"video_title":"%s","video_url":"%s"}'%(video_title,videoUrl)
url_gifshow = "https://v.kuaishou.com/s/zeKwaYfN"
result = parseGifShow(url_gifshow)
print(result)