<table><tr><td bgcolor=orange>本文所有教程及源码、软件仅为技术研究。不涉及计算机信息系统功能的删除、修改、增加、干扰,更不会影响计算机信息系统的正常运行。不得将代码用于非法用途,如侵立删!</td></tr></table>
小鹅通 pri-cdn-tx.xiaoeknow.com开头的视频下载方法
环境
- win10
- Python3.9
方法一:手动抓包拼接下载地址
pri-cdn-tx.xiaoeknow.com开头的视频,m3u8文件中ts地址是加密的,没有办法直接提取出来替换
1.解析sign、us
def get_detail_info(self, resource_id): """ 提取视频原始下载地址和参数: 'param': '?sign=8c366cd81db547a00172a39d032444f0&t=63948ea8&us=bvZemXXVQx' """ headers = { 'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36 Edg/105.0.1343.33', 'cookie': self.cookie } data = { 'bizData[resource_id]': resource_id, 'bizData[product_id]': self.product_id, 'bizData[opr_sys]': 'Win32' } response = requests.post(url, headers=headers, data=data) response = response.json() video_info = response['data']['video_info'] video_length = video_info['video_length'] file_name = video_info['file_name'] video_urls = response['data']['video_urls'] # m3u8 解密 video_urls = json.loads(self.dec_m3u8(video_urls)) results = [] for video_url in video_urls: host = video_url['ext']['host'] path = video_url['ext']['path'] baseuri = host + '/' + path + '/' param = '?' + video_url['ext']['param'] m3u8url = video_url['url'] # print(baseuri, param) info = { 'm3u8url': m3u8url, 'baseuri': baseuri, 'param': param, 'file_name': file_name } results.append(info) return results
2.去视频播放页面抓包,随便抓一个ts链接
3.手动拼接完整m3u8地址
加密参数:
sign=1cedf0ef8927be6e5ac8fb12ec86d44e&t=63974ac0&us=tPzxDODjWL
ts地址:
https://encrypt-k-vod.xet.tech/2919df88vodtranscq1252524126/ab176def5285890794132337419/drm/v.f230.ts?start=0&end=196655&type=mpegts&sign=3f0b7ebfaa621ee2d9ac9dd5266b635c&t=63974e6c&us=VyiZZyhZvP
方法二:根据视频信息脚本自动导出下载地址
# 店铺IPAPPID = 'appsw2t0vpw1085'# 视频id# resource_id = 'v_637cc24ee4b0edc794f95a2a'# 专栏idproduct_id = 'p_5d8f2045bcc1d_i2P94QXd'# 登录cookieCOOKIE = 'ko_token=354b9d9b1708677a7ed5a5b7ff29754f'