Python之爬虫-酷6视频
#!/usr/bin/env python # -*- coding:utf-8 -*- import re import requests
response = requests.get('https://www.ku6.com/index') data = response.text res =
re.findall('<a class="video-image-warp" target="_blank" href="(.*?)">', data)
for r in res: if r.startswith('/video/detail'): r = f'https://www.ku6.com{r}'
video_i_response = requests.get(r) video_i_data = video_i_response.text
video_url = re.findall('"video/mp4", src: "(.*?)"', video_i_data)[0] video_name
= video_url[0].split('_')[-1] + '.mp4' video_response = requests.get(video_url)
video_data = video_response.content with open(video_name, 'wb') as f:
f.write(video_data) print('爬取成功: ' + video_name)

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:637538335
关注微信