This commit is contained in:
parent
a1e9bb6330
commit
167389067d
@ -67,6 +67,7 @@ class YtService(_Service):
|
|||||||
try:
|
try:
|
||||||
info = track.extra_info
|
info = track.extra_info
|
||||||
if not info:
|
if not info:
|
||||||
|
# fallback ke parent class kalo gak ada info
|
||||||
super().download(track, file_path)
|
super().download(track, file_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -74,8 +75,11 @@ class YtService(_Service):
|
|||||||
ydl_opts["outtmpl"] = file_path.rsplit(".", 1)[0] + ".mp3"
|
ydl_opts["outtmpl"] = file_path.rsplit(".", 1)[0] + ".mp3"
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
dl = get_suitable_downloader(info)(ydl, ydl_opts)
|
# Download langsung pakai URL dari info
|
||||||
dl.download(file_path, 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:
|
except Exception as e:
|
||||||
logging.error(f"Download error: {str(e)}", exc_info=True)
|
logging.error(f"Download error: {str(e)}", exc_info=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user