#18 #15
This commit is contained in:
BennyThink 2021-10-19 18:58:48 +08:00
parent 9b2addabc4
commit 055b18514e
No known key found for this signature in database
GPG key ID: 6CD0DBDA5235D481
2 changed files with 10 additions and 4 deletions

View file

@ -15,8 +15,13 @@ import time
import fakeredis import fakeredis
import filetype 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 config import ENABLE_VIP
from limit import VIP, Redis from limit import VIP, Redis
@ -123,7 +128,7 @@ def ytdl_download(url, tempdir, bm) -> dict:
ydl_opts["format"] = f ydl_opts["format"] = f
try: try:
logging.info("Downloading for %s with format %s", url, f) 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]) ydl.download([url])
response["status"] = True response["status"] = True
response["error"] = "" response["error"] = ""

View file

@ -1,6 +1,7 @@
pyrogram==1.2.9 pyrogram==1.2.9
tgcrypto==1.2.2 tgcrypto==1.2.2
yt-dlp yt-dlp==2021.10.10
youtube-dl==2021.6.6
APScheduler==3.7.0 APScheduler==3.7.0
beautifultable==1.0.1 beautifultable==1.0.1
ffmpeg-python==0.2.0 ffmpeg-python==0.2.0