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)