import requests
# https://video.pearvideo.com/mp4/adshort/20210827/1630292282943-15755349_adpkg-ad_hd.mp4
# https://video.pearvideo.com/mp4/adshort/20210827/cont-1740134-15755349_adpkg-ad_hd.mp4
url = 'https://www.pearvideo.com/video_1740134'
contID = url.split("_")[1]
contID_url = f"https://www.pearvideo.com/videoStatus.jsp?contId={contID}&mrd=0.3711861873030182"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36",
"Referer": url
}
resp = requests.get(contID_url, headers=headers)
dic = resp.json()
systemTime = dic["systemTime"]
srcUrl = dic['videoInfo']['videos']['srcUrl']
srcUrl = srcUrl.replace(systemTime, f"cont-{contID}")
print(srcUrl)
with open("a.mp4", mode="wb") as f:
f.write(requests.get(srcUrl).content)