[GH-ISSUE #179] Passing a playlist id to get_watch_playlist gives an exception #137

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

Originally created by @jbruechert on GitHub (Mar 20, 2021).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/179

Albums and tracks work just fine with get_watch_playlist, but playlists don't (if I'm not doing something wrong).

Ther error is:

KeyError: 'content'

At:
  /usr/local/lib/python3.9/dist-packages/ytmusicapi/parsers/utils.py(210): nav
  /usr/local/lib/python3.9/dist-packages/ytmusicapi/mixins/watch.py(78): get_watch_playlist

A simple test case:

import ytmusicapi
yt = ytmusicapi.YTMusic()
yt.get_watch_playlist("VLPLMOhiB5NIEx7us1pGnMZXGcN6dSL45uZu")
Originally created by @jbruechert on GitHub (Mar 20, 2021). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/179 Albums and tracks work just fine with get_watch_playlist, but playlists don't (if I'm not doing something wrong). Ther error is: ``` KeyError: 'content' At: /usr/local/lib/python3.9/dist-packages/ytmusicapi/parsers/utils.py(210): nav /usr/local/lib/python3.9/dist-packages/ytmusicapi/mixins/watch.py(78): get_watch_playlist ``` A simple test case: ``` import ytmusicapi yt = ytmusicapi.YTMusic() yt.get_watch_playlist("VLPLMOhiB5NIEx7us1pGnMZXGcN6dSL45uZu") ```
kerem closed this issue 2026-02-27 22:08:14 +03:00
Author
Owner

@sigma67 commented on GitHub (Mar 20, 2021):

You need to call it like this

yt.get_watch_playlist(playlistId="PLMOhiB5NIEx7us1pGnMZXGcN6dSL45uZu")

<!-- gh-comment-id:803424912 --> @sigma67 commented on GitHub (Mar 20, 2021): You need to call it like this `yt.get_watch_playlist(playlistId="PLMOhiB5NIEx7us1pGnMZXGcN6dSL45uZu")`
Author
Owner

@jbruechert commented on GitHub (Mar 20, 2021):

Sorry, I messed up the test case. The error still occurs with

yt.get_watch_playlist(playlistId="VLPLMOhiB5NIEx7us1pGnMZXGcN6dSL45uZu")

too

<!-- gh-comment-id:803430302 --> @jbruechert commented on GitHub (Mar 20, 2021): Sorry, I messed up the test case. The error still occurs with ``` yt.get_watch_playlist(playlistId="VLPLMOhiB5NIEx7us1pGnMZXGcN6dSL45uZu") ``` too
Author
Owner

@jbruechert commented on GitHub (Mar 20, 2021):

I must have messed up the playlist id too, thank you for the help.

<!-- gh-comment-id:803430738 --> @jbruechert commented on GitHub (Mar 20, 2021): I must have messed up the playlist id too, thank you for the help.
Author
Owner

@jbruechert commented on GitHub (Mar 20, 2021):

Just in case someone finds this useful: I don't really understand why, but it is always necessary to remove the "VL" from the beginning of the playlist IDs.

<!-- gh-comment-id:803431774 --> @jbruechert commented on GitHub (Mar 20, 2021): Just in case someone finds this useful: I don't really understand why, but it is always necessary to remove the "VL" from the beginning of the playlist IDs.
Author
Owner

@sigma67 commented on GitHub (Mar 20, 2021):

Yes, that's why I removed the VL in my comment above.

YouTube sometimes uses the VL prefix internally. I think it's mainly a prefix to differentiate actual playlists from radio playlists and others. Some other endpoints like get_playlist can already handle the VL prefix, I suppose we could add something to `get_watch_playlist_ as well.

<!-- gh-comment-id:803432387 --> @sigma67 commented on GitHub (Mar 20, 2021): Yes, that's why I removed the VL in my comment above. YouTube sometimes uses the VL prefix internally. I think it's mainly a prefix to differentiate actual playlists from radio playlists and others. Some other endpoints like get_playlist can already handle the VL prefix, I suppose we could add something to `get_watch_playlist_ as well.
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#137
No description provided.