鬼灭-锻刀村提前看
使用python进行抓取素材组合视频
鬼灭之刃-锻刀村提前看
鬼灭之刃-锻刀村篇在bilibili上已经上映,每周一更的节奏实在难受的很。 与其苦等不如看看其他网站上的原版鬼灭。
通过百度搜索“鬼灭之刃 锻刀村”,发现网上走就流出了鬼灭的日本版本,而且没有了中国特色的河蟹,想必是更多LSP所希望看到的真鬼灭吧。
http://m.yinghua8.tv/v/6263-1.html 这个鬼灭手机网页版本的网站,大家可以通过这个网站观看鬼灭动画。
由于网络等各种因素,网站并没有给我们提供一个良好的观看环境。
怎么样才能拥有更好的观看环境呢
自然是把资源下载之后,通过电视或者电脑,在大屏幕上光看。
通过解析数据。网站将一集的内容拆分成了n个小份,根据顺序一个个的下载下来,在连续播放给我们。
下载视频
编写代码
import requests
from queue import Queue
from down_thread import DownThread
import os
"https://vip.ffzy-play3.com/20230417/11019_17b7467a/2000k/hls/mixed.m3u8"
def doChapter(info):
if "url" in info and "chapter" in info:
chapter = info["chapter"]
# url ="https://vip.ffzyread.com/20230501/11189_f8b02f97/2000k/hls/mixed.m3u8"
url = info["url"]
base_url = url[0:-11] #"https://vip.ffzy-play3.com/20230410/10768_94652f73/2000k/hls"
dir = chapter
if os.path.exists(dir) is False:
os.makedirs(dir)
f = open(os.path.join(dir,"concat.txt"),"w",encoding="utf-8")
res = requests.get(url)
if res.status_code == 200:
lines = res.text.split("\n")
que = Queue()
ths = []
for i in range(os.cpu_count()):
th = DownThread(que,i+1)
ths.append(th)
for t in ths:
t.start()
write_lines = []
for line in lines:
if line.startswith("#") or len(line) < 5:
continue
write_lines.append("file " + line + "\n")
que.put({"url":base_url+"/"+line, "dir":chapter})
f.writelines(write_lines)
f.close()
for i in range(os.cpu_count()):
que.put(None)
for t in ths:
t.join()
# 结束下载,开始拼接
cmd = f"ffmpeg.exe -f concat -i {chapter}/concat.txt {chapter}.mp4"
print(cmd)
os.system(cmd)
if __name__ == "__main__":
loop_target = [
{"url":"https://vip.ffzyread.com/20230508/11407_7880f968/2000k/hls/mixed.m3u8","chapter":"5"},
{"url":"https://vip.ffzyread.com/20230515/11693_e19aa1ad/2000k/hls/mixed.m3u8","chapter":"6"},
{"url":"https://vip.ffzyread.com/20230522/11913_e7acf307/2000k/hls/mixed.m3u8","chapter":"7"},
{"url":"https://vip.ffzyread.com/20230529/12112_e0c1f63c/2000k/hls/mixed.m3u8","chapter":"8"},
{"url":"https://vip.ffzyread.com/20230605/12384_d5bd3856/2000k/hls/mixed.m3u8","chapter":"9"},
{"url":"https://vip.ffzyread.com/20230612/12594_b3a224e4/2000k/hls/mixed.m3u8","chapter":"10"},
{"url":"https://vip.ffzyread.com/20230619/12812_970ea62b/2000k/hls/index.m3u8","chapter":"11"},
]
for ttt in loop_target:
doChapter(ttt)
下载代码
最后修改于 2023-06-26