From adb8a32840bb8a67c2592ac42bdcc03031a9ece9 Mon Sep 17 00:00:00 2001 From: justuser-31 Date: Wed, 13 Aug 2025 10:46:02 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=80=D1=83=20=D0=B1?= =?UTF-8?q?=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.py | 2 +- yt_downloader.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/db.py b/db.py index ea1a5f0..9fc350b 100644 --- a/db.py +++ b/db.py @@ -2,7 +2,7 @@ import os import json if not os.path.exists('conf.json'): - db = {'api_token': 'None'} + db = {'api_token': 'None', 'ytdlp_way': 'None'} js = json.dumps(db, indent=2) with open("conf.json", "w") as outfile: outfile.write(js) diff --git a/yt_downloader.py b/yt_downloader.py index 6c0a64a..b643897 100644 --- a/yt_downloader.py +++ b/yt_downloader.py @@ -15,6 +15,7 @@ logger = logging.getLogger(__name__) # Bot token from @BotFather CONFIG = read() BOT_TOKEN = CONFIG['api_token'] +YT_DLP = CONFIG['ytdlp_way'] bot = telebot.TeleBot(BOT_TOKEN) @@ -45,7 +46,7 @@ def handle_youtube_music_link(message): # Step 1: Get metadata using yt-dlp in simulate mode result = subprocess.run( - ["yt-dlp", "--print-json", "--skip-download", "--restrict-filenames", url], + [YT_DLP, "--print-json", "--skip-download", "--restrict-filenames", url], capture_output=True, text=True ) @@ -73,7 +74,7 @@ def handle_youtube_music_link(message): output_template = f"{user.id}_%(title)s.%(ext)s" download_result = subprocess.run( [ - "yt-dlp", + YT_DLP, "-x", "--audio-format", "mp3", "--audio-quality", "0", "--output", output_template, "--restrict-filenames",