Skip to content

Commit

Permalink
fix #713: get_artist radioId and shuffleId missing (#714)
Browse files Browse the repository at this point in the history
* fix #713: get_artist radioId and shuffleId missing

* format
  • Loading branch information
sigma67 authored Jan 8, 2025
1 parent 3bd3da1 commit 452b5cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions tests/mixins/test_browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def test_get_home(self, yt, yt_auth):
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"]
Expand Down
14 changes: 6 additions & 8 deletions ytmusicapi/mixins/browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ def get_artist(self, channelId: str) -> dict:
{
"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": {
Expand Down Expand Up @@ -258,12 +260,8 @@ def get_artist(self, channelId: str) -> dict:
)
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)
Expand Down

0 comments on commit 452b5cd

Please sign in to comment.