[Asm] 纯文本查看 复制代码 import requests
import re ,os
urls = "https://www.91kanju.com/vod-play/54812-1-1.html"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36"
}
def page_response(url):
rep = requests.get(url=url,headers=headers)
rep.encoding =rep.apparent_encoding
return rep
if not os.path.exists('./movie'):
os.mkdir('./movie')
rep = page_response(urls)
obj = re.compile(r"url: '(?P<url>.*?)',", re.S)
m3u8_url = obj.search(rep.text).group("url")
rep1 = page_response(m3u8_url)
rep2 = re.compile(r'(https://puui.qpic.cn/newsapp_ls/\d/\d+/\d)',re.S)
ts_urls = rep2.findall(rep1.text)
i =0
for ts in ts_urls:
path = './movie/' + ".mp4"
dow = page_response(ts)
with open(path,"ab") as pf:
pf.write(dow.content)
i += 1
print("第{}下载完成".format(i))
print("下载完毕") 新手交流 怎么加进程池呢 下载 太慢了 |