A Python application to populate a Spotify playlist with tracks from another Spotify playlist using the Spotify Web API.
The playlists I maintain with this app are: log cabin cafe & mt. fuji
Install the necessary Python packages by running:
$ pip install -r requirements.txt
This application uses the OAuth 2.0 authorization framework
Step 1. Register your app in Spotify for Developers
Note: save your client_id and client_secret
https://accounts.spotify.com/authorize?client_id=YOUR_ID&response_type=code&redirect_uri=YOUR_URI&scope=playlist-modify-public%20playlist-modify-private%20playlist-read-public%20playlist-read-private%20playlist-read-collaborative
Directly replace the following params:
YOUR_ID: Your given client id
YOUR_URI: URL-encoded exact match of app redirect uri
Note: save the code returned in the url
curl -H "Authorization: Basic YOUR_CREDENTIALS" -d grant_type=authorization_code -d code=YOUR_CODE -d redirect_uri=YOUR_URI https://accounts.spotify.com/api/token --ssl-no-revoke
Directly replace the following params:
YOUR_CREDENTIALS: Base64-encoded result of client_id:client_secret
YOUR_CODE: Code obtained in previous step
YOUR_URI: Same as before
Note: save the refresh token from the response json
Use the obtained refresh token and Base64-encoded credentials.
The user and playlist ids can be obtained from their corresponding urls or with the console.
The application can now be run any time without reauthorizing or any user input.
If you need any help refer to this tutorial.
Run the entry-point script:
$ python main.py