fixed yt.py pt6.
Some checks are pending
Build-nightly / docker (push) Waiting to run

This commit is contained in:
Umiko 2025-05-05 09:56:23 +07:00
parent a1e9bb6330
commit 167389067d

View File

@ -67,6 +67,7 @@ class YtService(_Service):
try:
info = track.extra_info
if not info:
# fallback ke parent class kalo gak ada info
super().download(track, file_path)
return
@ -74,8 +75,11 @@ class YtService(_Service):
ydl_opts["outtmpl"] = file_path.rsplit(".", 1)[0] + ".mp3"
with YoutubeDL(ydl_opts) as ydl:
dl = get_suitable_downloader(info)(ydl, ydl_opts)
dl.download(file_path, info)
# Download langsung pakai URL dari info
url = info.get("webpage_url")
if not url:
raise errors.ServiceError("Missing webpage_url in track info")
ydl.download([url])
except Exception as e:
logging.error(f"Download error: {str(e)}", exc_info=True)