python爬取VIP视频
# from urllib.request import urlopen
# url = \’https://www.baidu.com\’
# respons = urlopen(url)
# res = respons.read().decode(\’utf-8\’)
# print(res)
# import requests
# import json
# ##url=”https://movie.douban.com/j/search_subjects?”
# url=”https://www.baidu.com”
# param={
# “type”: “24”,
# “interval_id”: “100:90”,
# “action”:”” ,
# “start”: “1”,
# “limit”: “20”,
# }
# headers={
# “User-Agent”:”Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36″
# }
# respons=requests.get(url=url)
# data=respons.text.encode(“ISO-8859-1”)
# print(data.decode(\’utf-8\’).encoding(\’utf-8\’).decode(\’utf-8\’))
# # f=open(“./douban.json”,”w”,encoding=”utf-8″)
# # json.dump(data,fp=f,ensure_ascii=False)
# print(data)
import requests
from multiprocessing import Pool
def download(i):
requests.packages.urllib3.disable_warnings()
url=\’https://2.mhbobo.com/20190810/imDvND0R/1200kb/hls/oPwEP2038%s04d.ts\’ %i
r = requests.get(url,verify=False)
res = r.content
with open(\’./t/{}\’.format(url[-10:]),\’wb\’)as f:
f.write(res)
if __name__ == \’__main__\’:
pool = Pool(20)
for i in range(0,1541):
pool.apply_async(download,args=(i,))
pool.close()
pool.join()
# copy /b *.ts hecheng.ts