diff --git a/downloader.py b/downloader.py index 5440b77..397f7ab 100644 --- a/downloader.py +++ b/downloader.py @@ -15,8 +15,13 @@ import time import fakeredis import filetype -import yt_dlp -from yt_dlp import DownloadError + +if os.getenv("downloader") == "youtube-dl": + import youtube_dl as ytdl + from youtube_dl import DownloadError +else: + import yt_dlp as ytdl + from yt_dlp import DownloadError from config import ENABLE_VIP from limit import VIP, Redis @@ -123,7 +128,7 @@ def ytdl_download(url, tempdir, bm) -> dict: ydl_opts["format"] = f try: logging.info("Downloading for %s with format %s", url, f) - with yt_dlp.YoutubeDL(ydl_opts) as ydl: + with ytdl.YoutubeDL(ydl_opts) as ydl: ydl.download([url]) response["status"] = True response["error"] = "" diff --git a/requirements.txt b/requirements.txt index 4d50b49..2cfcfa0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ pyrogram==1.2.9 tgcrypto==1.2.2 -yt-dlp +yt-dlp==2021.10.10 +youtube-dl==2021.6.6 APScheduler==3.7.0 beautifultable==1.0.1 ffmpeg-python==0.2.0