From 86fb2ab1568837a18005199914b44adc3724603e Mon Sep 17 00:00:00 2001 From: Umiko Date: Mon, 5 May 2025 09:00:55 +0700 Subject: [PATCH] fixed yt.py pt4. --- bot/services/yt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot/services/yt.py b/bot/services/yt.py index f2b23da..b660ae7 100644 --- a/bot/services/yt.py +++ b/bot/services/yt.py @@ -72,8 +72,12 @@ class YtService(_Service): ydl_opts = self._ydl_config.copy() ydl_opts["outtmpl"] = file_path.rsplit(".", 1)[0] + ".mp3" + with YoutubeDL(ydl_opts) as ydl: - info = ydl.process_ie_result(info, download=True) + url = info.get('webpage_url') + if not url: + raise errors.ServiceError("No URL provided for download") + ydl.download([url]) except Exception as e: logging.error(f"Download error: {str(e)}", exc_info=True)