From c9605bff04d6ad0dd74994163abb34dd415c8dec Mon Sep 17 00:00:00 2001 From: Tianyu Chen Date: Wed, 16 Oct 2024 00:37:37 +0800 Subject: [PATCH] Handle cases where youtube_url may be from other providers (e.g., music.163.com) - Updated logic to check for the 'v' parameter in the query. - If 'v' is not present, the full URL is printed instead. --- mkchromecast/audio.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mkchromecast/audio.py b/mkchromecast/audio.py index 06a76fa9..18b23139 100644 --- a/mkchromecast/audio.py +++ b/mkchromecast/audio.py @@ -59,8 +59,13 @@ url_data = urllib.parse.urlparse(_mkcc.youtube_url) query = urllib.parse.parse_qs(url_data.query) - video = query["v"][0] + + if "v" in query: + video = query["v"][0] + else: + video = _mkcc.youtube_url print(colors.options("Playing video:") + " " + video) + command = ["youtube-dl", "-o", "-", _mkcc.youtube_url] media_type = "audio/mp4" else: