fix #713: get_artist radioId and shuffleId missing (#714)

* fix #713: get_artist radioId and shuffleId missing

* format
This commit is contained in:
sigma67 2025-01-08 08:48:07 +01:00 • committed by GitHub
commit 452b5cdf6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

@ -19,6 +19,8 @@ class TestBrowsing:
def test_get_artist(self, yt): def test_get_artist(self, yt):
results = yt.get_artist("MPLAUCmMUZbaYdNH0bEd1PAlAqsA") results = yt.get_artist("MPLAUCmMUZbaYdNH0bEd1PAlAqsA")
assert len(results) == 16 assert len(results) == 16
assert results["shuffleId"] is not None
assert results["radioId"] is not None
# test correctness of related artists # test correctness of related artists
related = results["related"]["results"] related = results["related"]["results"]

View file

@ -167,10 +167,12 @@ class BrowsingMixin(MixinProtocol):
{ {
"description": "Oasis were ...", "description": "Oasis were ...",
"views": "1838795605", "views": "3,693,390,359 views",
"name": "Oasis", "name": "Oasis",
"channelId": "UCUDVBtnOQi4c7E8jebpjc9Q", "channelId": "UCUDVBtnOQi4c7E8jebpjc9Q",
"subscribers": "2.3M", "shuffleId": "RDAOkjHYJjL1a3xspEyVkhHAsg",
"radioId": "RDEMkjHYJjL1a3xspEyVkhHAsg",
"subscribers": "3.86M",
"subscribed": false, "subscribed": false,
"thumbnails": [...], "thumbnails": [...],
"songs": { "songs": {
@ -258,12 +260,8 @@ class BrowsingMixin(MixinProtocol):
) )
subscription_button = header["subscriptionButton"]["subscribeButtonRenderer"] subscription_button = header["subscriptionButton"]["subscribeButtonRenderer"]
artist["channelId"] = subscription_button["channelId"] artist["channelId"] = subscription_button["channelId"]
artist["shuffleId"] = nav( artist["shuffleId"] = nav(header, ["playButton", "buttonRenderer", *NAVIGATION_PLAYLIST_ID], True)
header, ["playButton", "buttonRenderer", *NAVIGATION_WATCH_PLAYLIST_ID], True artist["radioId"] = nav(header, ["startRadioButton", "buttonRenderer", *NAVIGATION_PLAYLIST_ID], True)
)
artist["radioId"] = nav(
header, ["startRadioButton", "buttonRenderer", *NAVIGATION_WATCH_PLAYLIST_ID], True
)
artist["subscribers"] = nav(subscription_button, ["subscriberCountText", "runs", 0, "text"], True) artist["subscribers"] = nav(subscription_button, ["subscriberCountText", "runs", 0, "text"], True)
artist["subscribed"] = subscription_button["subscribed"] artist["subscribed"] = subscription_button["subscribed"]
artist["thumbnails"] = nav(header, THUMBNAILS, True) artist["thumbnails"] = nav(header, THUMBNAILS, True)