取消视频下载流程

This commit is contained in:
ClovertaTheTrilobita 2025-02-03 18:53:34 +08:00
parent 2e6ba61a4f
commit 5ac73876b4

View file

@ -69,15 +69,16 @@ async def get_video_file(message: MessageEvent):
cid = pages[0]['cid'] cid = pages[0]['cid']
video_url = biliVideos.get_video_file_url(keyword[0], cid) video_url = biliVideos.get_video_file_url(keyword[0], cid)
biliVideos.video_download(video_url, cid) # biliVideos.video_download(video_url, cid)
# biliVideos.transcode_video(f"{cid}.mp4",f"{cid}-o.mp4") # biliVideos.transcode_video(f"{cid}.mp4",f"{cid}-o.mp4")
try: try:
await bili_bv_search.send(Message(MessageSegment.file_video(Path(f"./src/videos/file/{cid}.mp4")))) # await bili_bv_search.send(Message(MessageSegment.file_video(Path(f"./src/videos/file/{cid}.mp4"))))
await bili_bv_search.send(MessageSegment.video(video_url))
except nonebot.adapters.qq.exception.ActionFailed: except nonebot.adapters.qq.exception.ActionFailed:
await bili_bv_search.finish("发送失败惹可能是视频过长请尽量搜索1分钟以内的视频吧。") await bili_bv_search.finish("发送失败惹可能是视频过长请尽量搜索1分钟以内的视频吧。")
biliVideos.delete_video(cid) # biliVideos.delete_video(cid)
elif len(keyword) >= 2: elif len(keyword) >= 2:
@ -100,13 +101,14 @@ async def get_video_file(message: MessageEvent):
cid = pages[page_num - 1]['cid'] cid = pages[page_num - 1]['cid']
video_url = biliVideos.get_video_file_url(keyword[0], cid) video_url = biliVideos.get_video_file_url(keyword[0], cid)
biliVideos.video_download(video_url, cid) # biliVideos.video_download(video_url, cid)
try: try:
await bili_bv_search.send(Message(MessageSegment.file_video(Path(f"./src/videos/file/{cid}.mp4")))) # await bili_bv_search.send(Message(MessageSegment.file_video(Path(f"./src/videos/file/{cid}.mp4"))))
await bili_bv_search.send(MessageSegment.video(video_url))
except nonebot.adapters.qq.exception.ActionFailed: except nonebot.adapters.qq.exception.ActionFailed:
await bili_bv_search.finish("发送失败惹可能是视频过长请尽量搜索1分钟以内的视频吧。") await bili_bv_search.finish("发送失败惹可能是视频过长请尽量搜索1分钟以内的视频吧。")
biliVideos.delete_video(cid) # biliVideos.delete_video(cid)
await bili_bv_search.finish() await bili_bv_search.finish()