import requests number = 0 while True: f_number = '{:05d}'.format(number) print(f_number) url = f'https://tx-safety-video.acfun.cn/mediacloud/acfun/acfun_video/c767b469f665d619-8ec610ccb1c6f61a2c99ac2503425ee8-hls_720p_hevc_1.{f_number}.ts?pkey=ABAoPNLWlLmComyNl9hAa_BrUEWr8RkeUkRoZVPD4d-yqu1qKMS8YRXZ2Si3tkr76nv9zUkw9Q39rXcrcCGbZ5mI1ZI2z8VUqAawNDUKxXUZbwQ7DZpwvjWvNCenP7tzqrI7NQZCk5SDLVJC1hWqQIaDQvES45l4rONdTIkgqAe_DF_WZRvCMPhWW8hJHlK3NI9xg3pJJWjD9BswmnBCY18aTwbOsoBVXEdCGj4QeTEB6CL-_VsCcapjk9Re-2rHTCQ&safety_id=AAKQvD37s69-v-AuIArhgo-O' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.121 Safari/537.36' } res = requests.get(url,headers=headers) if res.status_code==404: break open(f"ts视频集/{f_number}.ts","wb").write(res.content) number += 1 from moviepy.editor import * num=0 video_list = [] for num in range(number): f_num = '{:05d}'.format(num) video= VideoFileClip(f"ts视频集/{f_num}.ts") video_list.append(video) final=concatenate_videoclips(video_list) final.write_videofile("最终视频.mp4")
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 【爬虫】如何将A站视频下载并合成一个完整的视频
发表评论 取消回复