[GH-ISSUE #810] playlist_add_items has broken podcast episode id behavior #502

Closed
opened 2026-02-27 23:22:59 +03:00 by kerem · 8 comments
Owner

Originally created by @nknaian on GitHub (May 18, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/810

Describe the bug
The "playlist_add_items" function states in its documentation that you can pass a list of podcast ids, but actually it seems like the only ids you can pass are track ids because it assumes the type of the id is a "track" - https://github.com/plamere/spotipy/blob/master/spotipy/client.py#L1030. I was able to add podcast episodes by passing in uris instead, which is a fine workaround. Maybe this is simply a documentation clarification fix? I can see how it would be annoying to accomodate both track & podcast episode ids here...

Your code
playlist_id = "5WC4NBV9O101t7EpJYgiKB"
podcast_episode_id = "6Ac19ix9yioyJDXtTtNp2V"
sp.playlist_add_items(
playlist_id,
[podcast_episode_id]
)

Expected behavior
I expected that passing a list of podcast episode ids to the "playlist_add_items" function would result in the episodes being added to the playlist

Output
http status: 400, code:-1 - https://api.spotify.com/v1/playlists/5WC4NBV9O101t7EpJYgiKB/tracks:
Payload contains a non-existing ID, reason: None

Environment:

  • OS: Windows 10 WSL2
  • Python version 3.8.10
  • spotipy version 2.19.0
  • your IDE (if using any) Vscode

Additional context
Add any other context about the problem here.

Originally created by @nknaian on GitHub (May 18, 2022). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/810 **Describe the bug** The "playlist_add_items" function states in its documentation that you can pass a list of podcast ids, but actually it seems like the only ids you can pass are track ids because it assumes the type of the id is a "track" - https://github.com/plamere/spotipy/blob/master/spotipy/client.py#L1030. I was able to add podcast episodes by passing in uris instead, which is a fine workaround. Maybe this is simply a documentation clarification fix? I can see how it would be annoying to accomodate both track & podcast episode ids here... **Your code** playlist_id = "5WC4NBV9O101t7EpJYgiKB" podcast_episode_id = "6Ac19ix9yioyJDXtTtNp2V" sp.playlist_add_items( playlist_id, [podcast_episode_id] ) **Expected behavior** I expected that passing a list of podcast episode ids to the "playlist_add_items" function would result in the episodes being added to the playlist **Output** http status: 400, code:-1 - https://api.spotify.com/v1/playlists/5WC4NBV9O101t7EpJYgiKB/tracks: Payload contains a non-existing ID, reason: None **Environment:** - OS: Windows 10 WSL2 - Python version 3.8.10 - spotipy version 2.19.0 - your IDE (if using any) Vscode **Additional context** Add any other context about the problem here.
kerem 2026-02-27 23:22:59 +03:00
Author
Owner

@Peter-Schorn commented on GitHub (May 19, 2022):

Just use URIs instead of ids.

<!-- gh-comment-id:1130993216 --> @Peter-Schorn commented on GitHub (May 19, 2022): Just use `URI`s instead of ids.
Author
Owner

@nknaian commented on GitHub (May 19, 2022):

Yup I'll use uris instead. I think it would be helpful though if the doc comment for playlist_add_items specified that podcast episode items must be uris

<!-- gh-comment-id:1131771926 --> @nknaian commented on GitHub (May 19, 2022): Yup I'll use uris instead. I think it would be helpful though if the doc comment for `playlist_add_items` specified that podcast episode items must be uris
Author
Owner

@Peter-Schorn commented on GitHub (May 19, 2022):

You can't infer a URI from just an id.

<!-- gh-comment-id:1131794225 --> @Peter-Schorn commented on GitHub (May 19, 2022): You can't infer a URI from just an id.
Author
Owner

@nknaian commented on GitHub (May 19, 2022):

Right I understand that, but the doc comment seems to suggest that you can pass in a podcast episode id when you can't

<!-- gh-comment-id:1131830609 --> @nknaian commented on GitHub (May 19, 2022): Right I understand that, but the doc comment seems to suggest that you can pass in a podcast episode id when you can't
Author
Owner

@nknaian commented on GitHub (May 19, 2022):

And the function does automatically infer uri from id, it just assumes type track

<!-- gh-comment-id:1131832216 --> @nknaian commented on GitHub (May 19, 2022): And the function does automatically infer uri from id, it just assumes type track
Author
Owner

@Peter-Schorn commented on GitHub (May 21, 2022):

the only ids you can pass are track ids because it assumes the type of the id is a "track"

Correct.

You can pass a list of URIs instead, which include the ID category.

<!-- gh-comment-id:1133592248 --> @Peter-Schorn commented on GitHub (May 21, 2022): > the only ids you can pass are track ids because it assumes the type of the id is a "track" Correct. You can pass a list of URIs instead, which include the ID category.
Author
Owner

@stephanebruckert commented on GitHub (Dec 13, 2022):

To fix in v3 https://github.com/spotipy-dev/spotipy/issues/652

<!-- gh-comment-id:1349807154 --> @stephanebruckert commented on GitHub (Dec 13, 2022): To fix in v3 https://github.com/spotipy-dev/spotipy/issues/652
Author
Owner

@stephanebruckert commented on GitHub (Jan 19, 2025):

Completed as part of https://github.com/spotipy-dev/spotipy/pull/914, thanks @oliveraw!

(merged in v3, not released yet)

<!-- gh-comment-id:2600936538 --> @stephanebruckert commented on GitHub (Jan 19, 2025): Completed as part of https://github.com/spotipy-dev/spotipy/pull/914, thanks @oliveraw! (merged in v3, not released yet)
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/spotipy#502
No description provided.