from urllib import parse,request
import urllib header_dict = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko'}
for i in range(1328,3000):
url="https://ting55.com/book/9580-"+str(i)
req = request.Request(url=url, headers=header_dict)
res = request.urlopen(req)
res = res.read()
body=str(res,encoding='utf-8')
startStr='(function(){var a={m4a:"'
start=body.find(startStr)
end=body.find('"};ting55_play("m4a",')
url=body[start+len(startStr):int(end)]
LocalPath="D:/超品相师/"+str(i)+".m4a"
print('正在下载第'+str(i)+"集...")
urllib.request.urlretrieve(url,LocalPath)
05-02 11:03