supress error

This commit is contained in:
Benny 2023-05-20 20:43:05 +02:00
parent 941cc069cb
commit dd0627c045
No known key found for this signature in database
GPG key ID: 6CD0DBDA5235D481

View file

@ -7,6 +7,7 @@
__author__ = "Benny <benny.think@gmail.com>" __author__ = "Benny <benny.think@gmail.com>"
import contextlib
import logging import logging
import os import os
import random import random
@ -354,8 +355,10 @@ def link_checker(url: str) -> str:
if re.findall(r"m3u8|\.m3u8|\.m3u$", url.lower()): if re.findall(r"m3u8|\.m3u8|\.m3u$", url.lower()):
return "m3u8 links are disabled." 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) @app.on_message(filters.incoming & filters.text)