Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Spotify Playlist
#4
(May-31-2020, 05:24 PM)Benji1995 Wrote: Hey DreamingInsanity, thank you for your reply!

I checked the attached link, but as I said before, I'm a complete noob with Python and Spotify API, i just know what they are but I can't use them.

I tried searching on the internet, but I think this is a rather specific situation so there is nothing on YouTube..

Do you think it is possible to code something similar to what I requested?
Technically it's against the rules but you know, I was bored so I did:
CLIENT_ID = ""
CLIENT_SECRET = ""

PLAYLIST_ID = ""
USERNAME = ""
PLAYLIST_NAME = ""

import spotipy
import spotipy.util as util

token = util.prompt_for_user_token(USERNAME, "playlist-modify-public", CLIENT_ID, CLIENT_SECRET, "https://example.com/callback")
sp = spotipy.Spotify(auth=token)

playlists = sp.user_playlist_change_details(USERNAME, playlist_id=PLAYLIST_ID, name=PLAYLIST_NAME, public=True)
Firstly, you need to run: pip install spotipy
Then, go to: https://developer.spotify.com/dashboard/ and sign in. Click on 'create a new app' and follow the steps. Once you are done, copy the client id into 'CLIENT_ID' and the client secret into 'CLIENT SECRET' (don't share these with anyone)
Next, open spotify, right click your playlist, go to 'share' and then 'copy spotify URI'. Delete everything that is 'spotify:playlist:'. Take what's left and put it in 'PLAYLIST_ID',
Fill out 'USERNAME' with your spotify username.
'PLAYLIST_NAME' is what you want you playlist to be named.

Now run the script. It should open your browser and ask you for a url. Click the button to authorise the app. Once you have been redirected, copy the url and paste it into where it wants you to. Once you have done this it should have renamed your playlist.
It's a bit long to have it open up your browser but it doesn't seem like there's much I can do about it.
Reply


Messages In This Thread
Help with Spotify Playlist - by Benji1995 - May-31-2020, 04:45 PM
RE: Help with Spotify Playlist - by Benji1995 - May-31-2020, 05:24 PM
RE: Help with Spotify Playlist - by DreamingInsanity - May-31-2020, 07:56 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020