[GH-ISSUE #165] get_artist KeyError: 'playButton' #126

Closed
opened 2026-02-27 22:08:10 +03:00 by kerem · 10 comments
Owner

Originally created by @chaos87 on GitHub (Feb 3, 2021).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/165

Hi,

I'm using 0.14.1 and when I do (unauthenticated)

from ytmusicapi import YTMusic
ytmusic = YTMusic()
ytmusic.get_artist('UCbCrm_eTkVVRbwnR0cj-phQ')

I get

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-17-842c3ff40966> in <module>()
     16 #     print(fuzz.ratio(query.lower(), artist))
     17 # df_search
---> 18 ytmusic.get_artist('UCbCrm_eTkVVRbwnR0cj-phQ')
     19 # wFMCbgy1S3A

2 frames
/usr/local/lib/python3.6/dist-packages/ytmusicapi/mixins/browsing.py in get_artist(self, channelId)
    279         artist['channelId'] = subscription_button['channelId']
    280         artist['shuffleId'] = nav(header,
--> 281                                   ['playButton', 'buttonRenderer'] + NAVIGATION_WATCH_PLAYLIST_ID)
    282         artist['radioId'] = nav(header, ['startRadioButton', 'buttonRenderer']
    283                                 + NAVIGATION_WATCH_PLAYLIST_ID)

/usr/local/lib/python3.6/dist-packages/ytmusicapi/parsers/utils.py in nav(root, items, none_if_absent)
    208             return None
    209         else:
--> 210             raise err
    211 
    212 

/usr/local/lib/python3.6/dist-packages/ytmusicapi/parsers/utils.py in nav(root, items, none_if_absent)
    202     try:
    203         for k in items:
--> 204             root = root[k]
    205         return root
    206     except Exception as err:

KeyError: 'playButton'
Originally created by @chaos87 on GitHub (Feb 3, 2021). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/165 Hi, I'm using 0.14.1 and when I do (unauthenticated) ```python from ytmusicapi import YTMusic ytmusic = YTMusic() ytmusic.get_artist('UCbCrm_eTkVVRbwnR0cj-phQ') ``` I get ``` --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-17-842c3ff40966> in <module>() 16 # print(fuzz.ratio(query.lower(), artist)) 17 # df_search ---> 18 ytmusic.get_artist('UCbCrm_eTkVVRbwnR0cj-phQ') 19 # wFMCbgy1S3A 2 frames /usr/local/lib/python3.6/dist-packages/ytmusicapi/mixins/browsing.py in get_artist(self, channelId) 279 artist['channelId'] = subscription_button['channelId'] 280 artist['shuffleId'] = nav(header, --> 281 ['playButton', 'buttonRenderer'] + NAVIGATION_WATCH_PLAYLIST_ID) 282 artist['radioId'] = nav(header, ['startRadioButton', 'buttonRenderer'] 283 + NAVIGATION_WATCH_PLAYLIST_ID) /usr/local/lib/python3.6/dist-packages/ytmusicapi/parsers/utils.py in nav(root, items, none_if_absent) 208 return None 209 else: --> 210 raise err 211 212 /usr/local/lib/python3.6/dist-packages/ytmusicapi/parsers/utils.py in nav(root, items, none_if_absent) 202 try: 203 for k in items: --> 204 root = root[k] 205 return root 206 except Exception as err: KeyError: 'playButton' ```
kerem closed this issue 2026-02-27 22:08:10 +03:00
Author
Owner

@sigma67 commented on GitHub (Feb 3, 2021):

Good find, seems not every artist has shuffle/radio mixes

<!-- gh-comment-id:772369521 --> @sigma67 commented on GitHub (Feb 3, 2021): Good find, seems not every artist has shuffle/radio mixes
Author
Owner

@bohrasankalp commented on GitHub (Feb 3, 2021):

The issue still persists.

I ended up with

Traceback (most recent call last):
  File "/home/sony/Desktop/yt/lib/python3.6/site-packages/ytmusicapi/parsers/utils.py", line 210, in nav
    raise err
  File "/home/sony/Desktop/yt/lib/python3.6/site-packages/ytmusicapi/parsers/utils.py", line 204, in nav
    root = root[k]
KeyError: 'playButton'

<!-- gh-comment-id:772388395 --> @bohrasankalp commented on GitHub (Feb 3, 2021): The issue still persists. I ended up with ```bash Traceback (most recent call last): File "/home/sony/Desktop/yt/lib/python3.6/site-packages/ytmusicapi/parsers/utils.py", line 210, in nav raise err File "/home/sony/Desktop/yt/lib/python3.6/site-packages/ytmusicapi/parsers/utils.py", line 204, in nav root = root[k] KeyError: 'playButton' ```
Author
Owner

@sigma67 commented on GitHub (Feb 3, 2021):

Which artist? The artist mentioned above should be fine.

Did you use the latest Github master with pip install git+https://github.com/sigma67/ytmusicapi?

<!-- gh-comment-id:772393272 --> @sigma67 commented on GitHub (Feb 3, 2021): Which artist? The artist mentioned above should be fine. Did you use the latest Github master with `pip install git+https://github.com/sigma67/ytmusicapi`?
Author
Owner

@bohrasankalp commented on GitHub (Feb 3, 2021):

Try with this. artistId = "UCpZQNFrsFaC9bQgwcruLcwg". I have installed the latest. Even run this command before searching here.

<!-- gh-comment-id:772394709 --> @bohrasankalp commented on GitHub (Feb 3, 2021): Try with this. artistId = "UCpZQNFrsFaC9bQgwcruLcwg". I have installed the latest. Even run this command before searching here.
Author
Owner

@sigma67 commented on GitHub (Feb 3, 2021):

Sorry but it should work fine if you are on abbc13f. I get the following results:

{
  "description": null,
  "views": null,
  "name": "Chitra Singh",
  "channelId": "UCpZQNFrsFaC9bQgwcruLcwg",
  "shuffleId": null,
  "radioId": null,
  "subscribers": "11.1K",
  "subscribed": false,
  "thumbnails": [],
  "songs": {
    "browseId": "VLPLM5K8amubQnA3Cljlf7a8xV8jEuUBjyLk",
    "results": [],
    "params": "6gPeAUNxTUJDb01CQ25RQUFHV..."
  }
}
<!-- gh-comment-id:772424077 --> @sigma67 commented on GitHub (Feb 3, 2021): Sorry but it should work fine if you are on abbc13f. I get the following results: ```json { "description": null, "views": null, "name": "Chitra Singh", "channelId": "UCpZQNFrsFaC9bQgwcruLcwg", "shuffleId": null, "radioId": null, "subscribers": "11.1K", "subscribed": false, "thumbnails": [], "songs": { "browseId": "VLPLM5K8amubQnA3Cljlf7a8xV8jEuUBjyLk", "results": [], "params": "6gPeAUNxTUJDb01CQ25RQUFHV..." } } ```
Author
Owner

@bohrasankalp commented on GitHub (Feb 3, 2021):

Then pip install git+https://github.com/sigma67/ytmusicapi doesn't update me to the latest.

<!-- gh-comment-id:772430255 --> @bohrasankalp commented on GitHub (Feb 3, 2021): Then `pip install git+https://github.com/sigma67/ytmusicapi` doesn't update me to the latest.
Author
Owner

@sigma67 commented on GitHub (Feb 3, 2021):

Try adding -U switch, since version number has not changed yet.

<!-- gh-comment-id:772437702 --> @sigma67 commented on GitHub (Feb 3, 2021): Try adding `-U` switch, since version number has not changed yet.
Author
Owner

@bohrasankalp commented on GitHub (Feb 3, 2021):

No, it doesn't work. There should be some other workaround.

<!-- gh-comment-id:772466419 --> @bohrasankalp commented on GitHub (Feb 3, 2021): No, it doesn't work. There should be some other workaround.
Author
Owner

@sigma67 commented on GitHub (Feb 3, 2021):

As I said, it works fine for me. Wait until the release of 0.14.2 or submit a PR if you can identify something else that's wrong

<!-- gh-comment-id:772467707 --> @sigma67 commented on GitHub (Feb 3, 2021): As I said, it works fine for me. Wait until the release of 0.14.2 or submit a PR if you can identify something else that's wrong
Author
Owner

@chaos87 commented on GitHub (Feb 3, 2021):

Cool it works for me with your latest commit. Thanks

<!-- gh-comment-id:772498930 --> @chaos87 commented on GitHub (Feb 3, 2021): Cool it works for me with your latest commit. Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#126
No description provided.