Commit ae286ea

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-08-29 01:46:18
fix(download): use `stream=True` when downloading some files
1 parent 10c4aca
Changed files (2)
src/others/download_external.py
@@ -57,7 +57,7 @@ async def download_url_in_message(client: Client, message: Message, extra_prefix
     success = False
     path = Path("non-exist")
     try:
-        path = await download_file(url, proxy=PROXY.DOWNLOAD, **kwargs)
+        path = await download_file(url, proxy=PROXY.DOWNLOAD, stream=True, **kwargs)
         path = Path(path)
         suffix = path.suffix
         if (mime := guess_mime(path)) and not mime.startswith("text"):
src/others/podcast.py
@@ -60,10 +60,10 @@ async def summary_pods(client: Client):
             logger.info(f"Updating podcast {feed_title}: {entry['title']}")
             try:
                 retry = 0
-                path = await download_file(enclosure)
+                path = await download_file(enclosure, stream=True)
                 while not path:
                     retry += 1
-                    path = await download_file(enclosure)
+                    path = await download_file(enclosure, stream=True)
                     if retry > 3:
                         logger.error(f"Failed download podcast {feed_title} -- {entry['title']}")
                         await send2tg(client, message, texts=f"Failed download podcast {feed_title} -- {entry['title']}", reply_msg_id=-1)