把爱奇艺上的无法下载内容down到本地
#encoding=utf-8
import urllib.request
import os
# 下载文件到本地的函数
def download(fileUrl):
# 获取网络文件的文件名
filename = os.path.basename(fileUrl)
rsp=urllib.request.urlopen(fileUrl)
img=rsp.read()
with open(filename,'wb') as f:
f.write(img)
for i in range(0,1000):
s = '%03d' % i
print(s)
url="https://www.aiqiyi.com/123456/GQ/video"+s+".ts"
print(url)
while True:
try:
download(url)
break
except:
print("重新连接")
continue
print("downloaded")
# 合并ts文件 copy /b *.ts final.ts
努力让自己变得不那么low