[GH-ISSUE #439] KeyError: 'gridRenderer' for get_artist_albums #330

Closed
opened 2026-02-27 23:00:13 +03:00 by kerem · 5 comments
Owner

Originally created by @fabi321 on GitHub (Sep 25, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/439

Whenever using YTMusic.get_artist_albums, it fails with a KeyError: 'gridRenderer'

To Reproduce
Steps to reproduce the behavior:

>>> from ytmusicapi import YTMusic
>>> ytmusic = YTMusic()
>>> ytmusic.get_artist_albums('UCM-CWGUijAC-8idv6k6Fygw', 'ggMIegYIARoCAQI%3D')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/project/.venv/lib/python3.11/site-packages/ytmusicapi/mixins/browsing.py", line 255, in get_artist_albums
    results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + GRID_ITEMS)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/project/.venv/lib/python3.11/site-packages/ytmusicapi/navigation.py", line 81, in nav
    raise err
  File "~/project/.venv/lib/python3.11/site-packages/ytmusicapi/navigation.py", line 75, in nav
    root = root[k]
           ~~~~^^^
KeyError: 'gridRenderer'
Originally created by @fabi321 on GitHub (Sep 25, 2023). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/439 Whenever using `YTMusic.get_artist_albums`, it fails with a `KeyError: 'gridRenderer'` **To Reproduce** Steps to reproduce the behavior: ``` >>> from ytmusicapi import YTMusic >>> ytmusic = YTMusic() >>> ytmusic.get_artist_albums('UCM-CWGUijAC-8idv6k6Fygw', 'ggMIegYIARoCAQI%3D') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "~/project/.venv/lib/python3.11/site-packages/ytmusicapi/mixins/browsing.py", line 255, in get_artist_albums results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + GRID_ITEMS) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "~/project/.venv/lib/python3.11/site-packages/ytmusicapi/navigation.py", line 81, in nav raise err File "~/project/.venv/lib/python3.11/site-packages/ytmusicapi/navigation.py", line 75, in nav root = root[k] ~~~~^^^ KeyError: 'gridRenderer' ```
kerem 2026-02-27 23:00:13 +03:00
  • closed this issue
  • added the
    yt-update
    label
Author
Owner

@sigma67 commented on GitHub (Sep 25, 2023):

Seems there's been an update and you can now filter by Albums/Singles and sort.

PR welcome.

<!-- gh-comment-id:1734346380 --> @sigma67 commented on GitHub (Sep 25, 2023): Seems there's been an update and you can now filter by Albums/Singles and sort. PR welcome.
Author
Owner

@fabi321 commented on GitHub (Sep 25, 2023):

One problem I'm currently facing is https://music.youtube.com/browse/UCNms80n59AltHVQuPgGrKkg
The params points to a list of musicResponsiveListItemRenderer, which matches the Songs shelf in ytmusic, but the params are clearly taken from the Albums shelf. I'm not sure, who's to fault there.

artist response:

[
  {
    "musicShelfRenderer": {
      "title": {
        "runs": [
          {
            "text": "Songs",
            ...
  },
  {
    "musicCarouselShelfRenderer": {
      "header": {
        "musicCarouselShelfBasicHeaderRenderer": {
          "title": {
            "runs": [
              {
                "text": "Albums",
                "navigationEndpoint": {
                  "browseEndpoint": {
                    "browseId": "MPADUCNms80n59AltHVQuPgGrKkg",
                    "params": "ggMIegYIARoCAQI%3D",
...

response using this endpoint + parameters:

{
  "musicShelfRenderer": {
    "title": {
      "runs": [
        {
          "text": "Songs",
          "navigationEndpoint": {
            "browseEndpoint": {
              "browseId": "VLOLAK5uy_l4hMfu2sKTre4vbmEVhMWXc7HXZcdc-Os",
              "params": "ggMCCAI%3D",
              }
            }
          }
        }
      ]
    },
    "contents": [
      {
        "musicResponsiveListItemRenderer": 
...
<!-- gh-comment-id:1734400910 --> @fabi321 commented on GitHub (Sep 25, 2023): One problem I'm currently facing is https://music.youtube.com/browse/UCNms80n59AltHVQuPgGrKkg The params points to a list of `musicResponsiveListItemRenderer`, which matches the `Songs` shelf in ytmusic, but the params are clearly taken from the `Albums` shelf. I'm not sure, who's to fault there. artist response: ```json [ { "musicShelfRenderer": { "title": { "runs": [ { "text": "Songs", ... }, { "musicCarouselShelfRenderer": { "header": { "musicCarouselShelfBasicHeaderRenderer": { "title": { "runs": [ { "text": "Albums", "navigationEndpoint": { "browseEndpoint": { "browseId": "MPADUCNms80n59AltHVQuPgGrKkg", "params": "ggMIegYIARoCAQI%3D", ... ``` response using this endpoint + parameters: ```json { "musicShelfRenderer": { "title": { "runs": [ { "text": "Songs", "navigationEndpoint": { "browseEndpoint": { "browseId": "VLOLAK5uy_l4hMfu2sKTre4vbmEVhMWXc7HXZcdc-Os", "params": "ggMCCAI%3D", } } } } ] }, "contents": [ { "musicResponsiveListItemRenderer": ... ```
Author
Owner

@fabi321 commented on GitHub (Sep 25, 2023):

I was to blame for that last mistake. I wrongly assumed, that I could use the channelId as browseId for getting albums, while that isn't always the case. Fixing that fixed the issue.

<!-- gh-comment-id:1734423244 --> @fabi321 commented on GitHub (Sep 25, 2023): I was to blame for that last mistake. I wrongly assumed, that I could use the channelId as browseId for getting albums, while that isn't always the case. Fixing that fixed the issue.
Author
Owner

@sigma67 commented on GitHub (Sep 25, 2023):

#441 for the new features

<!-- gh-comment-id:1734470067 --> @sigma67 commented on GitHub (Sep 25, 2023): #441 for the new features
Author
Owner

@sigma67 commented on GitHub (Jan 10, 2024):

#441 is now completed

<!-- gh-comment-id:1885661731 --> @sigma67 commented on GitHub (Jan 10, 2024): #441 is now completed
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#330
No description provided.