import requests import re from tqdm import tqdm,trange url="https://0e1e652b3fded2c214e3e0157920582f9bea23f486354785.v.smtcdns.com/moviets.tc.qq.com/AYypFrqQ7L550DLKzwRzMWfkE9nzzWcbCmw2gAsdJjto/B_JxNyiJmktHRgresXhfyMeidH8TgfldSux1TdZJZ-VV2nT5dnS4eZBXZ9iizdepRG/svp_50112/xy4-f29jFn3e3vqA1mSyBEs-A0DLDwcvGCl1dCWFOblum3Ay_C9gfYwBNdA2P2_lv9rMCuGv2h9SC_c0BEi2racgVxMXZ2PgXd40jFTvhVvPPgAN3QZjDStQvS17FRTBSbCHCFjj1dW7V0NMVGUK1GM06Gj_fRC9MKiqsDyjtBzWvzFxDD0QABkvyVPUouKC3Bf-mtx6xjfOBuOojGDtI-UB0ufJf7ZwSB--OVj1IGwsfSap87fWTg/gzc_1000102_0b533iaagaaa2yagw2sfvbtmbwwdaovaab2a.f321002.ts.m3u8?ver=4" response= requests.get(url) m3u8_text= response.text m3u8_text=re.sub('#.*','',m3u8_text) ts_list = m3u8_text.split() for ts in tqdm(ts_list): ts_url='https://0e1e652b3fded2c214e3e0157920582f9bea23f486354785.v.smtcdns.com/moviets.tc.qq.com/AYypFrqQ7L550DLKzwRzMWfkE9nzzWcbCmw2gAsdJjto/B_JxNyiJmktHRgresXhfyMeidH8TgfldSux1TdZJZ-VV2nT5dnS4eZBXZ9iizdepRG/svp_50112/xy4-f29jFn3e3vqA1mSyBEs-A0DLDwcvGCl1dCWFOblum3Ay_C9gfYwBNdA2P2_lv9rMCuGv2h9SC_c0BEi2racgVxMXZ2PgXd40jFTvhVvPPgAN3QZjDStQvS17FRTBSbCHCFjj1dW7V0NMVGUK1GM06Gj_fRC9MKiqsDyjtBzWvzFxDD0QABkvyVPUouKC3Bf-mtx6xjfOBuOojGDtI-UB0ufJf7ZwSB--OVj1IGwsfSap87fWTg/'+ts #保存数据 video=requests.get(ts_url).content open("庆余年3.mp4",mode='ab').write(video)