文件下载函数
u
url='https://apd-51a311629b2cd4c407b72bf56abbefb6.v.smtcdns.com/vhot2.qqvideo.tc.qq.com/AwuZOHiluJGUYG6huDu7SWc6SaZdAdG_pQu5hVOBRSfw/B_9LhzPzw8agpeEeKUHV_JXnnP5rTtHKAkZAwRwRvgews/svp_50069/gzc_1000035_0b536yb3gaadh4alsyadtjsjn5wdwp3ahm2a.f622.mp4?sdtfrom=v1104&guid=5947d6b6a1e3cc8fce77b286c351eae9&vkey=E51A5D57265500F203C1157DE0DC93DF6699F9EF914D7161414C702034EDC22C459554A0BE775AF7B322D29724F0B76E9E754D67D3A57474114C6554AE9437C768863986CDC3ABA6B5EFF36DC744564B380516ADF85934A6A21E36DAED5E6D5B86D1B1583FC3203E3F6786FE9D604904D6ADAE5FEFBF7C421447B882FCAD4E5A93BF272989F55008'
urllib.request.urlretrieve(url,'D:\王者语音包\干将新皮肤.mp4')
rllib.request.urlretrieve(url,'D:\王者语音包\干将新皮肤.mp4')
ts合成mp4文件
url='ts 文件的url'
data=requests.get(url).content
with open('.pm4','ab') as f:
f.write(data)
aqy的m3u8
在video下面的4中
m3u8
获取对应的.ts url
url='https://cache.video.iqiyi.com/dash?tvid=3493131456125200&bid=200&vid=6819b944d85b5b6470bf9b8b60b8aa01&src=01010031010000000000&vt=0&rs=1&uid=3678349054553600&ori=pcw&ps=1&k_uid=5c74e6c5cee9346675af3d34c816e665&pt=0&d=0&s=&lid=&cf=&ct=&authKey=120743abb219f08c6b65194c83f8cecc&k_tag=1&dfp=a1c904650627a24d5795e8653d4601522dbf45ccc8b500a54de404220d4acaccea&locale=zh_cn&prio=%7B%22ff%22%3A%22f4v%22%2C%22code%22%3A2%7D&pck=03cvsjeheXObhPsV1ZunPjcSm3FXqyBX0G9APm2i8uE28eaNj3OCiSZRwFE5N6bEubhC68&k_err_retries=0&up=&sr=1&qd_v=5&tm=1677940149898&qdy=u&qds=0&k_ft1=704237197590532&k_ft4=1161084346048516&k_ft5=134217729&k_ft7=4&bop=%7B%22version%22%3A%2210.0%22%2C%22dfp%22%3A%22a1c904650627a24d5795e8653d4601522dbf45ccc8b500a54de404220d4acaccea%22%2C%22b_ft1%22%3A8%7D&ut=0&vf=84d21afea6de4d259b1b21f8e868082a'
data=requests.get(url=url).json()#解析json数据
m3u8_text=data['data']['program']['video'][4]['m3u8']#获取m3u8中的ts url
m3u8_list=re.sub('#E.*','',m3u8_text).split()#使用正则表达式提取数据并用split转换成列表