使用Python批量下载ts格式视频
import os
import requests
# Python学习资料白嫖扣裙:708525271
def download(url, filenames, dirname):
session = requests.Session()
for filename in filenames:
print(u"downloading: %s" % filename)
r = session.get(url + filename, stream=True).iter_content(chunk_size=1024 * 1024)
filepath = os.path.join(dirname, filename)
print(u"saving: %s" % filename)
with open(filepath, 'wb') as f:
for chunk in r:
chunk and f.write(chunk)
print(u"finished: %s" % filename)