大家好,又见面了,我是你们的朋友全栈君。
import requests
from multiprocessing import Pool
def mission(url,n):
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"}
print('*****')
response=requests.get(url,headers=headers)
print('-----')
f=open("./1/%03d.ts"%n,"wb")
f.write(response.content)
f.close()
print("%03d.ts OK..."%n)
if __name__ == "__main__":
pool=Pool(20)
for n in range(1,38):
url = "https://f1.media.brightcove.com/1/1362235890001/5796758914001/1362235890001_5796758914001_s-{}.ts?pubId=1362235890001&videoId=1655020599001".format(n)
pool.apply_async(mission,(url,n))
pool.close()
pool.join()
在windows系统下面,直接可以使用:copy/b *.ts video.mp4 把所有ts文件合成一个mp4格式文件
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/161201.html原文链接:https://javaforall.cn