import osimport ffmpy3import requestsfrom bs4 import BeautifulSoupfrom multiprocessing.dummy import Pool as ThreadPoolarch_keyword = '越狱第一季'arch_url = 'http://www.jisudhw.com/index.php'rach_params = {'m': 'vod-arch'}rach_headers = { 'Ur-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36', 'Referer': 'http://www.jisudhw.com/', 'Origin': 'http://www.jisudhw.com', 'Host': 'www.jisudhw.com'}rach_datas = {'wd': arch_keyword, 'submit': 'arch'}video_dir = ''r = requests.post(url=arch_url, params=rach_params, headers=rach_headers, data=rach_datas)r.encoding = 'utf-8'rver = 'http://www.jisudhw.com'arch_html = BeautifulSoup(r.text, 'lxml')arch_spans = arch_html.find_all('span', class_='xing_vb4')for span in arch_spans: url = rver + span.a.get('href') name = span.a.string print(name) print(url) video_dir = name if name not i断桥雪n os.listdir('./'): os.mkdir(name) detail_url = url r = requests.get(url=detail_url) r.encoding = 'utf-8' detail_bf = BeautifulSoup(r.text, 'lxml') num = 1 rach_res = {} for each_url in detail_bf.find_all('i乌鲁木齐到喀纳斯nput'): if 'm3u8' in each_url.get('value'): url = each_url.get('value') if url not in rach_res.keys(): 中山学校rach_res[url] = num print('第%03d集:' % num) print(url) num += 1def downVideo(url): num = rach_res[url] name = os.path.join(video_dir, '第%03d集.mp4' % num) ffmpy3.FFmpeg(executable='D:\\program files\\ffmpeg\\bin\\ffmpeg.exe', inputs={ url: None }, outputs={ 实验室制备氯气 name: None }).run()# 开8个线程池pool = ThreadPool(8)results = pool.map(downVideo, rach_res.keys())pool.clo()pool.join()
早安爆笑短句运行时效果
视频列表
本文地址:https://blog.csdn.net/m0_37712876/article/details/107655530
本文发布于:2023-04-08 21:09:27,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/2c40961060e87e693d57106e1de0855f.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:视频爬虫.doc
本文 PDF 下载地址:视频爬虫.pdf
留言与评论(共有 0 条评论) |