[GH-ISSUE #486] What is wrong with this exact playlist? #287

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

Originally created by @eliasbenb on GitHub (Apr 28, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/486

I'm trying to get the artist names of tracks in a playlist. This is the playlist link, it is owned by Spotify and has no local tracks. The issue is when I try to get the name I get this error:

Traceback (most recent call last):
  File "c:/Users/user/Downloads/test.py", line 21, in <module>
    print(track['track']['artists'][0]['name'])
TypeError: 'NoneType' object is not subscriptable

So obviously Spotipy thinks that the artist name doesn't exist, but if you go on the playlist and trace it back to the song you get this profile and it obviously exists. Any ideas why? This is the code:

import spotipy
import spotipy.util as util

SPOTIFY_CLIENT_ID = "..."
SPOTIFY_CLIENT_SECRET = "..."
SCOPE = 'playlist-read-collaborative,playlist-read-private,playlist-modify-public,playlist-modify-private'
SPOTIFY_REDIRECT_URI = "http://127.0.0.1:5000/callback"

token = util.prompt_for_user_token("spotify", SCOPE, SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, SPOTIFY_REDIRECT_URI)

if token:
    sp = spotipy.Spotify(auth=token)
    sp.trace = False
    playlists_soup = sp.current_user_playlists()
    playlist = playlists_soup['items'][4] # 4 is just the playlist index on my profile
    playlist_id = playlist['id']

    tracks = sp.playlist_tracks(playlist_id)
    
    for track in tracks['items']:
        print(track['track']['artists'][0]['name'])
Originally created by @eliasbenb on GitHub (Apr 28, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/486 I'm trying to get the artist names of tracks in a playlist. [This](https://open.spotify.com/playlist/37i9dQZF1DWSfMe9z89s9B?si=5an1d4msSwOSSWR7LWsF2g) is the playlist link, it is owned by Spotify and has no local tracks. The issue is when I try to get the name I get this error: ``` Traceback (most recent call last): File "c:/Users/user/Downloads/test.py", line 21, in <module> print(track['track']['artists'][0]['name']) TypeError: 'NoneType' object is not subscriptable ``` So obviously Spotipy thinks that the artist name doesn't exist, but if you go on the playlist and trace it back to the song you get [this](https://open.spotify.com/artist/20PdOyVym0ZZrOB1rfcvCR?si=gKbHIb_SSb6JUkDz1RIPEQ) profile and it obviously exists. Any ideas why? This is the code: ``` import spotipy import spotipy.util as util SPOTIFY_CLIENT_ID = "..." SPOTIFY_CLIENT_SECRET = "..." SCOPE = 'playlist-read-collaborative,playlist-read-private,playlist-modify-public,playlist-modify-private' SPOTIFY_REDIRECT_URI = "http://127.0.0.1:5000/callback" token = util.prompt_for_user_token("spotify", SCOPE, SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, SPOTIFY_REDIRECT_URI) if token: sp = spotipy.Spotify(auth=token) sp.trace = False playlists_soup = sp.current_user_playlists() playlist = playlists_soup['items'][4] # 4 is just the playlist index on my profile playlist_id = playlist['id'] tracks = sp.playlist_tracks(playlist_id) for track in tracks['items']: print(track['track']['artists'][0]['name']) ```
kerem closed this issue 2026-02-27 23:21:49 +03:00
Author
Owner

@stephanebruckert commented on GitHub (Apr 28, 2020):

To debug your code you should follow my previous advice https://github.com/plamere/spotipy/issues/472#issuecomment-613593131

<!-- gh-comment-id:620581666 --> @stephanebruckert commented on GitHub (Apr 28, 2020): To debug your code you should follow my previous advice https://github.com/plamere/spotipy/issues/472#issuecomment-613593131
Author
Owner

@eliasbenb commented on GitHub (Apr 28, 2020):

To debug your code you should follow my previous advice #472 (comment)

OK. Thank you, I just did that and it turns out that it isn't the artist that doesn't work, but it's the track this is the output I get after printing the track with pprint(tracks['items'][26])

{'added_at': '2020-04-24T14:14:39Z',
 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/'},
              'href': 'https://api.spotify.com/v1/users/',
              'id': '',
              'type': 'user',
              'uri': 'spotify:user:'},
 'is_local': False,
 'primary_color': None,
 'track': None,
 'video_thumbnail': {'url': None}}

So is this an issue on Spotify's side?

<!-- gh-comment-id:620600783 --> @eliasbenb commented on GitHub (Apr 28, 2020): > To debug your code you should follow my previous advice [#472 (comment)](https://github.com/plamere/spotipy/issues/472#issuecomment-613593131) OK. Thank you, I just did that and it turns out that it isn't the artist that doesn't work, but it's the [track](https://open.spotify.com/track/2OvuQMxW5b0VT8btiNugfL?si=hpwX3WX7Tz2PP3t5oYifww) this is the output I get after printing the track with `pprint(tracks['items'][26])` ``` {'added_at': '2020-04-24T14:14:39Z', 'added_by': {'external_urls': {'spotify': 'https://open.spotify.com/user/'}, 'href': 'https://api.spotify.com/v1/users/', 'id': '', 'type': 'user', 'uri': 'spotify:user:'}, 'is_local': False, 'primary_color': None, 'track': None, 'video_thumbnail': {'url': None}} ``` So is this an issue on Spotify's side?
Author
Owner

@FOREVEREALIZE commented on GitHub (Jan 6, 2024):

Since it's owned by Spotify, they might just have messed something up doing a Database edit.

<!-- gh-comment-id:1879628865 --> @FOREVEREALIZE commented on GitHub (Jan 6, 2024): Since it's owned by Spotify, they might just have messed something up doing a Database edit.
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#287
No description provided.