From 452b5cdf6e169ac6a7a4cd7f7f9154abb5cc708e Mon Sep 17 00:00:00 2001 From: sigma67 <16363825+sigma67@users.noreply.github.com> Date: Wed, 8 Jan 2025 08:48:07 +0100 Subject: [PATCH] fix #713: get_artist radioId and shuffleId missing (#714) * fix #713: get_artist radioId and shuffleId missing * format --- tests/mixins/test_browsing.py | 2 ++ ytmusicapi/mixins/browsing.py | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/mixins/test_browsing.py b/tests/mixins/test_browsing.py index 2244652..b6798a5 100644 --- a/tests/mixins/test_browsing.py +++ b/tests/mixins/test_browsing.py @@ -19,6 +19,8 @@ class TestBrowsing: def test_get_artist(self, yt): results = yt.get_artist("MPLAUCmMUZbaYdNH0bEd1PAlAqsA") assert len(results) == 16 + assert results["shuffleId"] is not None + assert results["radioId"] is not None # test correctness of related artists related = results["related"]["results"] diff --git a/ytmusicapi/mixins/browsing.py b/ytmusicapi/mixins/browsing.py index b96ce4f..31eb6b2 100644 --- a/ytmusicapi/mixins/browsing.py +++ b/ytmusicapi/mixins/browsing.py @@ -167,10 +167,12 @@ class BrowsingMixin(MixinProtocol): { "description": "Oasis were ...", - "views": "1838795605", + "views": "3,693,390,359 views", "name": "Oasis", "channelId": "UCUDVBtnOQi4c7E8jebpjc9Q", - "subscribers": "2.3M", + "shuffleId": "RDAOkjHYJjL1a3xspEyVkhHAsg", + "radioId": "RDEMkjHYJjL1a3xspEyVkhHAsg", + "subscribers": "3.86M", "subscribed": false, "thumbnails": [...], "songs": { @@ -258,12 +260,8 @@ class BrowsingMixin(MixinProtocol): ) subscription_button = header["subscriptionButton"]["subscribeButtonRenderer"] artist["channelId"] = subscription_button["channelId"] - artist["shuffleId"] = nav( - header, ["playButton", "buttonRenderer", *NAVIGATION_WATCH_PLAYLIST_ID], True - ) - artist["radioId"] = nav( - header, ["startRadioButton", "buttonRenderer", *NAVIGATION_WATCH_PLAYLIST_ID], True - ) + artist["shuffleId"] = nav(header, ["playButton", "buttonRenderer", *NAVIGATION_PLAYLIST_ID], True) + artist["radioId"] = nav(header, ["startRadioButton", "buttonRenderer", *NAVIGATION_PLAYLIST_ID], True) artist["subscribers"] = nav(subscription_button, ["subscriberCountText", "runs", 0, "text"], True) artist["subscribed"] = subscription_button["subscribed"] artist["thumbnails"] = nav(header, THUMBNAILS, True)