[GH-ISSUE #271] Parsing error in get_artist_albums #210

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

Originally created by @fabi321 on GitHub (May 8, 2022).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/271

On some channels this happens occasionally, but I finally fond a channel where it happens every single time. The artist is Eluveitie, channel id UClV0x3k5Oxm7vREoLEOPeGg.
After using get_artist to get general info, it returns an album list containing a params string. When running get_artist_albums, it fails with the following stacktrace:

  File "/main.py", line 79, in get_albums_for_artist
    return ytmusic.get_artist_albums(artist['channelId'], artist['albums']['params'])
  File "/.venv/lib/python3.10/site-packages/ytmusicapi/mixins/browsing.py", line 446, in get_artist_albums
    results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + GRID_ITEMS)
  File "/.venv/lib/python3.10/site-packages/ytmusicapi/parsers/utils.py", line 155, in nav
    raise err
  File "/.venv/lib/python3.10/site-packages/ytmusicapi/parsers/utils.py", line 149, in nav
    root = root[k]
KeyError: 'content'

looking into the response of https://github.com/sigma67/ytmusicapi/blob/master/ytmusicapi/mixins/browsing.py#L254, I got the following content:

{
  "responseContext": {...},
  "contents": {
    "singleColumnBrowseResultsRenderer": {
      "tabs": [
        {
          "tabRenderer": {
            "trackingParams": "..."
          }
        }
      ]
    }
  },
  "header": {
    "musicHeaderRenderer": {
      "title": {
        "runs": [
          {
            "text": "Eluveitie"
          }
        ]
      },
      "trackingParams": "..."
    }
  },
  "trackingParams": "..."
}

Version: 0.21.0
There are other channels, where the same issue happened sometimes, but not always.

Originally created by @fabi321 on GitHub (May 8, 2022). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/271 On some channels this happens occasionally, but I finally fond a channel where it happens every single time. The artist is `Eluveitie`, channel id `UClV0x3k5Oxm7vREoLEOPeGg`. After using `get_artist` to get general info, it returns an album list containing a `params` string. When running `get_artist_albums`, it fails with the following stacktrace: ``` File "/main.py", line 79, in get_albums_for_artist return ytmusic.get_artist_albums(artist['channelId'], artist['albums']['params']) File "/.venv/lib/python3.10/site-packages/ytmusicapi/mixins/browsing.py", line 446, in get_artist_albums results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + GRID_ITEMS) File "/.venv/lib/python3.10/site-packages/ytmusicapi/parsers/utils.py", line 155, in nav raise err File "/.venv/lib/python3.10/site-packages/ytmusicapi/parsers/utils.py", line 149, in nav root = root[k] KeyError: 'content' ``` looking into the response of https://github.com/sigma67/ytmusicapi/blob/master/ytmusicapi/mixins/browsing.py#L254, I got the following content: ```json { "responseContext": {...}, "contents": { "singleColumnBrowseResultsRenderer": { "tabs": [ { "tabRenderer": { "trackingParams": "..." } } ] } }, "header": { "musicHeaderRenderer": { "title": { "runs": [ { "text": "Eluveitie" } ] }, "trackingParams": "..." } }, "trackingParams": "..." } ``` Version: `0.21.0` There are other channels, where the same issue happened sometimes, but not always.
kerem closed this issue 2026-02-27 22:08:37 +03:00
Author
Owner

@sigma67 commented on GitHub (May 9, 2022):

I believe this is related to a recently fixed issue where unauthenticated users would sometimes be served YouTube's consent page instead of the actual page content. I discovered this issue last week when I observed tests failing (seemingly) randomly. After spending some time debugging I found that it only happens for unauthenticated users and fixed the root cause in 7c242ba.

Please pull and install the latest master for now, a new release containing the fix will be pushed this week.

<!-- gh-comment-id:1120954459 --> @sigma67 commented on GitHub (May 9, 2022): I believe this is related to a recently fixed issue where unauthenticated users would sometimes be served YouTube's consent page instead of the actual page content. I discovered this issue last week when I observed tests failing (seemingly) randomly. After spending some time debugging I found that it only happens for unauthenticated users and fixed the root cause in 7c242ba. Please pull and install the latest master for now, a new release containing the fix will be pushed this week.
Author
Owner

@fabi321 commented on GitHub (May 9, 2022):

I just checked this and can confirm that the issue is fixed on the latest master version

<!-- gh-comment-id:1121209952 --> @fabi321 commented on GitHub (May 9, 2022): I just checked this and can confirm that the issue is fixed on the latest master version
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#210
No description provided.