视频数据真实地址如何快速获取并保存

#本文仅供学习交流之用

如何获取视频数据真实地址

# https://video.pearvideo.com/mp4/short/20240719/cont-1795356-16033004-hd.mp4

# https://www.pearvideo.com/videoStatus.jsp?contId=1795356&mrd=0.4354187029041643
# https://video.pearvideo.com/mp4/short/20240719/1721916865062-16033004-hd.mp4
# https://image2.pearvideo.com/cont/20240719/cont-1795356-12764477.png
# systemTime: "1721916865062
import json

import requests
url='https://www.pearvideo.com/videoStatus.jsp?contId=1795356'
conid=url.split('=')[1]
print(conid)

headers = {
    'Accept': 'application/json, text/javascript, */*; q=0.01',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Connection': 'keep-alive',
  
    'Referer': 'https://www.pearvideo.com/video_1795356',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest',
    'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
    'sec-ch-ua-mobile': '?1',
    'sec-ch-ua-platform': '"Android"',
}

params = {
    'contId': '1795356',
    'mrd': '0.4354187029041643',
}

response = requests.get('https://www.pearvideo.com/videoStatus.jsp', params=params, cookies=cookies, headers=headers)
context = json.loads(response.text)
print(context)

systime = context['systemTime']
videourl= context['videoInfo']['videos']['srcUrl']
print(systime,videourl)
videonewurl= videourl.replace(systime,'cont-'+conid)
print(videonewurl)
open(f'{conid}.mp4','wb').write(requests.get(videonewurl).content)
  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

青龙摄影

你的鼓励是我创作的动力,支持下

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值