"referer": "http://www.5nj.com/njplay/?id=https://zuikzy.yiya520.com/20180326/LUQ2vOuD/index.m3u8",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
}
#文件的多少
num = name+1
#几位数字,数字前加上几个0
s = str(num).zfill(5)
# 获取到url,观察就只有后面几个数字在变化,提取出来
url = "https://zuikzy.yiya520.com/20180326/LUQ2vOuD/1000kb/hls/tePouM3571" + s + ".ts";
print(url)
response = requests.get(url, headers=headers)
#获取文件的二进制代码
data = response.content
#保存数据
save_data(data,str(num))
#传入数据和名字
def save_data(data,num):
num = num.zfill(4)
with open(num+".ts","wb") as f:
f.write(data)
f.close()
from concurrent.futures import ThreadPoolExecutor # 线程池
#应该是线程池50是数量
p = ThreadPoolExecutor(50)
for name in range(1, 800): # 【根据url修改】
p.submit(pares_data,name)