Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Web API does not create public playlist

Web API does not create public playlist

My Question or Issue

Although public parameter is set to true the created is playlist is not public.

Reply
5 Replies

It works on my end. Can you please show me some of your code to see if there is a bug in it?

You can insert a cod block by first clicking on …, and then at </>

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

I use spotipy library in python.

 

import spotipy
from spotipy.oauth2 import SpotifyOAuth
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id=client_id, client_secret=client_secret, redirect_uri=ruri, scope="playlist-modify-public",username=os.getenv('SPOTIFY_USER_ID'),cache_path=".cache"))
def create_playlist(name,tracks):
    if tracks == []:
        return None
    playlist = sp.user_playlist_create(user=os.getenv('SPOTIFY_USER_ID'), name=name, public=True)
    sp.user_playlist_add_tracks(user=os.getenv('SPOTIFY_USER_ID'), playlist_id=playlist['id'], tracks=tracks)
    return playlist['id']

 

When this didn't work, I went to this page in Web API docs and called the API from there. And the created playlist was not public either.

 

Thank you in advance.

Thank you for sharing.

I tested your code, and the created playlists are getting added to my profile ( = public).

One remark: sp.user_playlist_add_tracks() is deprecated, and you should use sp.playlist_add_items(playlist_id, items, position=None) instead. (API reference)

 
XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Thank you.

But there is still a issue. I can see the playlist under Pubic Playlists in My Profile page but when I copy the url to an incognito tab spotify cannot find the page. I tried searching the playlist by name but it didn't work either.

It's weird you can not access your created playlist in private mode with a link. (Mine just work fine.)

But, it takes time before google indexes a playlist, and many playlists don't get indexed at all.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts