爬取梨视频

SpiderWebsite
peiv25okq 4 years ago
parent d57e591e0a
commit 3c5a83c426

@ -0,0 +1,25 @@
# https://video.pearvideo.com/mp4/adshort/20210422/1619097978738-15662110_adpkg-ad_hd.mp4
# https://video.pearvideo.com/mp4/adshort/20210422/cont-1727568-15662110_adpkg-ad_hd.mp4
# 1727568
# 1619098173405
# https://www.pearvideo.com/video_1727568
#拿到contid
#拿到status返回的json-》srcurl
#srcurl内容修改
import requests
url = "https://www.pearvideo.com/video_1727568"
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 '
'Safari/537.36 Edg/90.0.818.42 '
,"Referer":"https://www.pearvideo.com/video_1727568"
}
cont_id = url.split("_")[1]
video_status_url = "https://www.pearvideo.com/videoStatus.jsp?contId={cont_id}&mrd=0.36960144774889314"
response = requests.get(url=video_status_url, headers=headers)
srcurl = response.json()['videoInfo']['videos']['srcUrl']
systemtime = response.json()['systemTime']
srcurl = srcurl.replace(systemtime,"cont-"+cont_id)
don = requests.get(srcurl)
with open("a.mp4","wb") as f:
f.write(don.content)
Loading…
Cancel
Save