From dd0627c045d00066bba1e04a0c4e512f3ff58582 Mon Sep 17 00:00:00 2001 From: Benny Date: Sat, 20 May 2023 20:43:05 +0200 Subject: [PATCH] supress error --- ytdlbot/ytdl_bot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ytdlbot/ytdl_bot.py b/ytdlbot/ytdl_bot.py index 08b1795..f9f8211 100644 --- a/ytdlbot/ytdl_bot.py +++ b/ytdlbot/ytdl_bot.py @@ -7,6 +7,7 @@ __author__ = "Benny " +import contextlib import logging import os import random @@ -354,8 +355,10 @@ def link_checker(url: str) -> str: if re.findall(r"m3u8|\.m3u8|\.m3u$", url.lower()): return "m3u8 links are disabled." - if ytdl.extract_info(url, download=False).get("live_status") == "is_live": - return "Live stream links are disabled. Please download it after the stream ends." + + with contextlib.suppress(yt_dlp.utils.DownloadError): + if ytdl.extract_info(url, download=False).get("live_status") == "is_live": + return "Live stream links are disabled. Please download it after the stream ends." @app.on_message(filters.incoming & filters.text)