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)