Spotify API Returns public: False for All Playlists Despite Being Public

49 Views Asked by At

I am using the Spotify API through the Spotipy library in Python to check the public status of various playlists. However, I consistently receive public: False for all playlists, despite them being publicly accessible and owned by me.

Problem

The issue occurs when fetching playlist details using the Spotipy library. Every playlist, regardless of its actual status, returns with public: False.

Approach

  • Authentication via OAuth with the playlist-read-private scope.
  • The script successfully retrieves other details of the playlists.
  • All tested playlists are owned by my account.

Code Example

import os
import spotipy
from spotipy.oauth2 import SpotifyOAuth

# OAuth authentication setup
auth_manager = SpotifyOAuth(
    client_id=os.getenv("SPOTIFY_CLIENT_ID"),
    client_secret=os.getenv("SPOTIFY_CLIENT_SECRET"),
    redirect_uri='http://127.0.0.1:5000/callback',
    scope='playlist-read-private'
)
code = auth_manager.parse_response_code(httpd.path)
token_info = auth_manager.get_access_token(code, as_dict=False)
sp = spotipy.Spotify(auth=token)

# Fetching playlist details
playlist_details = sp.playlist(playlist_url)

Question

Why does the Spotify API return public: False for playlists that are publicly accessible? Is there an issue with the scopes, or am I missing something in my implementation?

Python version: 3.9.13

0

There are 0 best solutions below