From 3c5a83c426d8ac637eb56c63e9bea865298af888 Mon Sep 17 00:00:00 2001 From: peiv25okq <907209307@qq.com> Date: Wed, 28 Apr 2021 16:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=88=AC=E5=8F=96=E6=A2=A8=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 防盗链.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 防盗链.py diff --git a/防盗链.py b/防盗链.py new file mode 100644 index 0000000..9e5044a --- /dev/null +++ b/防盗链.py @@ -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) \ No newline at end of file