[GH-ISSUE #338] How can I get the name of a playlist? #197

Closed
opened 2026-02-27 23:21:20 +03:00 by kerem · 2 comments
Owner

Originally created by @xmztools on GitHub (Nov 8, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/338

I'm trying to get tracks from a playlist using user_playlist() (or user_playlist_tracks()) but I also want to get the name of the playlist. As far as I can tell there doesn't seem to be a name for the playlist anywhere in the returned JSON however. So I'm just wondering where I can get the name of a playlist (if all I have is the Spotify URI)? Is there another function I can use?

When looking at the Spotify API, I noticed this function in the docs returns a playlist object that has a lot of information (like name, description, href, etc.) that doesn't seem to be included in user_playlist():

https://developer.spotify.com/documentation/web-api/reference/playlists/get-playlist/

Is there a way to get this using Spotipy?

Originally created by @xmztools on GitHub (Nov 8, 2018). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/338 I'm trying to get tracks from a playlist using `user_playlist()` (or `user_playlist_tracks()`) but I also want to get the name of the playlist. As far as I can tell there doesn't seem to be a name for the playlist anywhere in the returned JSON however. So I'm just wondering where I can get the name of a playlist (if all I have is the Spotify URI)? Is there another function I can use? When looking at the Spotify API, I noticed this function in the docs returns a playlist object that has a lot of information (like name, description, href, etc.) that doesn't seem to be included in `user_playlist()`: https://developer.spotify.com/documentation/web-api/reference/playlists/get-playlist/ Is there a way to get this using Spotipy?
kerem closed this issue 2026-02-27 23:21:20 +03:00
Author
Owner

@ritiek commented on GitHub (Nov 8, 2018):

You need to pass name in fields keyword argument and then you fetch the value of name key from the response. For example to fetch this playlist:

https://open.spotify.com/playlist/3cqDkXVInhOYPpJyVzvwux

>>> results = spotify.user_playlist(user=None, playlist_id="3cqDkXVInhOYPpJyVzvwux", fields="name")
>>> results["name"]
'Progresso'

This example contains some example stuff (if not all) that can go into fields argument to fetch additional info about a playlist.

<!-- gh-comment-id:437034925 --> @ritiek commented on GitHub (Nov 8, 2018): You need to pass `name` in `fields` keyword argument and then you fetch the value of `name` key from the response. For example to fetch this playlist: https://open.spotify.com/playlist/3cqDkXVInhOYPpJyVzvwux ```python >>> results = spotify.user_playlist(user=None, playlist_id="3cqDkXVInhOYPpJyVzvwux", fields="name") >>> results["name"] 'Progresso' ``` [This example](https://developer.spotify.com/console/get-playlist/?playlist_id=59ZbFPES4DQwEjBpWHzrtC&user_id=spotify&fields=fields%3Dhref%2Cname%2Cowner(!href%2Cexternal_urls)%2Ctracks.items(added_by.id%2Ctrack(name%2Chref%2Calbum(name%2Chref)))) contains some example stuff (if not all) that can go into `fields` argument to fetch additional info about a playlist.
Author
Owner

@xmztools commented on GitHub (Nov 10, 2018):

Thank you! :)

<!-- gh-comment-id:437575841 --> @xmztools commented on GitHub (Nov 10, 2018): Thank you! :)
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#197
No description provided.