mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-25 15:54:09 +08:00
Clean resond from yt-dlp download errror (#328)
This commit is contained in:
parent
6c37e82b3d
commit
882b313a18
1 changed files with 10 additions and 2 deletions
|
@ -118,6 +118,10 @@ def ytdl_download_task(chat_id: int, message_id: int, url: str):
|
||||||
else:
|
else:
|
||||||
bot_msg.edit_text(f"{e}\nBig file download is not available now. Please /buy or try again later ")
|
bot_msg.edit_text(f"{e}\nBig file download is not available now. Please /buy or try again later ")
|
||||||
except Exception:
|
except Exception:
|
||||||
|
error_msg = traceback.format_exc().split("yt_dlp.utils.DownloadError: ERROR: ")
|
||||||
|
if len(error_msg) > 1:
|
||||||
|
bot_msg.edit_text(f"Download failed!❌\n\n`{error_msg[-1]}", disable_web_page_preview=True)
|
||||||
|
else:
|
||||||
bot_msg.edit_text(f"Download failed!❌\n\n`{traceback.format_exc()[-2000:]}`", disable_web_page_preview=True)
|
bot_msg.edit_text(f"Download failed!❌\n\n`{traceback.format_exc()[-2000:]}`", disable_web_page_preview=True)
|
||||||
logging.info("YouTube celery tasks ended.")
|
logging.info("YouTube celery tasks ended.")
|
||||||
|
|
||||||
|
@ -191,6 +195,10 @@ def ytdl_download_entrance(client: Client, bot_msg: types.Message, url: str, mod
|
||||||
bot_msg.edit_text(f"{e}\nBig file download is not available now. Please /buy or try again later ")
|
bot_msg.edit_text(f"{e}\nBig file download is not available now. Please /buy or try again later ")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Failed to download %s, error: %s", url, e)
|
logging.error("Failed to download %s, error: %s", url, e)
|
||||||
|
error_msg = traceback.format_exc().split("yt_dlp.utils.DownloadError: ERROR: ")
|
||||||
|
if len(error_msg) > 1:
|
||||||
|
bot_msg.edit_text(f"Download failed!❌\n\n`{error_msg[-1]}", disable_web_page_preview=True)
|
||||||
|
else:
|
||||||
bot_msg.edit_text(f"Download failed!❌\n\n`{traceback.format_exc()[-2000:]}`", disable_web_page_preview=True)
|
bot_msg.edit_text(f"Download failed!❌\n\n`{traceback.format_exc()[-2000:]}`", disable_web_page_preview=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue