Commit 51c7615

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-04-29 18:14:19
chore(subtitle): use title as txt filename
1 parent 6202233
Changed files (1)
src
src/others/subtitle.py
@@ -61,7 +61,7 @@ async def get_subtitle(client: Client, message: Message, youtube_subtitle_provid
         caption = f"🔴[{vinfo['author']}]({vinfo['channel']})\n🕒{vinfo['date']:%Y-%m-%d %H:%M:%S}\n"
         caption += f"📝[{vinfo['title']}]({yt_url})\n字符数: {res['num_chars']}\n阅读时长: {res['reading_minutes']:.1f}分钟"
         with io.BytesIO(subtitles.encode("utf-8")) as f:
-            await client.send_document(to_int(target_chat), f, file_name="字幕文件.txt", caption=caption)
+            await client.send_document(to_int(target_chat), f, file_name=f"{vinfo['title']}.txt", caption=caption)
     else:
         caption = f"原视频: [{vid}]({yt_url})\n字符数: {res['num_chars']}\n阅读时长: {res['reading_minutes']:.1f}分钟"
         with io.BytesIO(subtitles.encode("utf-8")) as f: