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,7 +118,11 @@ def ytdl_download_task(chat_id: int, message_id: int, url: str):
|
|||
else:
|
||||
bot_msg.edit_text(f"{e}\nBig file download is not available now. Please /buy or try again later ")
|
||||
except Exception:
|
||||
bot_msg.edit_text(f"Download failed!❌\n\n`{traceback.format_exc()[-2000:]}`", disable_web_page_preview=True)
|
||||
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)
|
||||
logging.info("YouTube celery tasks ended.")
|
||||
|
||||
|
||||
|
@ -191,7 +195,11 @@ 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 ")
|
||||
except Exception as e:
|
||||
logging.error("Failed to download %s, error: %s", url, e)
|
||||
bot_msg.edit_text(f"Download failed!❌\n\n`{traceback.format_exc()[-2000:]}`", disable_web_page_preview=True)
|
||||
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)
|
||||
|
||||
|
||||
def direct_download_entrance(client: Client, bot_msg: typing.Union[types.Message, typing.Coroutine], url: str):
|
||||
|
|
Loading…
Reference in a new issue