Commit 4aa4a73
Changed files (2)
src
ytdlp
src/ytdlp/download.py
@@ -66,6 +66,7 @@ async def ytdlp_download(
return {}
msg = f"✅下载成功:\n{info['summary']}"
logger.success(f"{msg!r}")
+ info["thumb"] = find_thumbnail(info["video_path"], info["audio_path"])
await modify_progress(text=msg.strip(), force_update=True, **kwargs)
return info
@@ -106,7 +107,6 @@ def download_video_info(url: str, ytdlp_opts: dict, json_path: str | Path) -> di
else:
info["video_path"] = Path("/non-exist")
info["audio_path"] = Path("/non-exist")
- info["thumb"] = find_thumbnail(info["video_path"], info["audio_path"])
summary = ""
if info["author"]:
summary += f"\n{platform_emoji(info['extractor'])}{info['author']}"
src/ytdlp/main.py
@@ -275,7 +275,7 @@ async def send_media(
await modify_progress(text=f"🎬视频大小超过Telegram限制({MAX_FILE_BYTES / 1024 / 1024:.0f}MB), 正在切分...", **kwargs)
videos = await preprocess_media([{"video": video_path, "thumb": thumb}])
for idx, video in enumerate(videos):
- video["thumb"] = thumb
+ video["thumb"] = thumb # use the same thumb for all videos
caption = info["caption"].replace("📝[", f"📝[P{idx + 1}-") if len(videos) > 1 else info["caption"]
caption = (await smart_split(caption, CAPTION_LENGTH))[0]
await modify_progress(text=f"🎬视频上传中-P{idx + 1}: {readable_size(path=video['video'])}", force_update=True, **kwargs)
@@ -303,7 +303,7 @@ async def send_media(
reply_parameters=reply_parameters,
progress=telegram_uploading,
progress_args=(kwargs.get("progress", False), audio_path, true(kwargs.get("detail_progress"))), # message, path, detail_progress
- thumb=thumb, # type: ignore
+ thumb=info["thumb"],
)
await modify_progress(del_status=True, **kwargs)
sent_messages = {}