|
楼主 |
发表于 2020-4-20 23:00:24
|
显示全部楼层
广东省惠州市
from urllib import request
import time
url="https://leshi.cdn-zuyida.com/20180121/KXHDAHhM/800kb/hls/OB71q1S1905000.ts"
url1=url[:-7]
print(url1)
#headers=[
#"user-agent" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"]
a=5000
for a in range(4999,5301,1):
a=a+1
print(a)
url2=url1+str(a)+".ts"
request.urlretrieve(url2, "C:/Users/Administrator/Desktop/py/" + str(a) + ".ts")
time.sleep(2)
这个是用request,很容易卡死,不动,都是自己摸索的, |
|