I have been manually saving Spotify's discover weekly into their own seperate playlists for a while now. I got tired of that, so I created this script that does that for me. I have it setup on a raspberrry pi and runs as a cron job. Setup information is bellow. c. Python 3 only
You must pip install 'spotipy' to use this script http://spotipy.readthedocs.io/en/latest/
- Register your application with Spotify to get the neccessary api clients and secrets
- Add those values as environment variables on the machine you want to run it as
- Add the redirect domain
http://locahost:8080
to your valid redirect domains on your application
- Add the following environment variables to your .bashrc file or other corresponding file
export SPOTIFY_CLIENT_ID=$YOUR_CLIENT_ID
export SPOTIFY_CLIENT_SECRET=$YOUR_CLIENT_SECRET
export SPOTIFY_PLAYLIST_ID=$YOUR_DISCOVER_WEEKLY_ID
export SPOTIFY_USERNAME=$YOUR_SPOTIFY_USERNAME
- Run the script
python script.py
- The script will open a browser with an authentication window
- Go through the flow and enter your credentials this will rederict you to a localhost address
- Copy that address and paste it into your terminal
- Your application shown be authorized now
Now with server support be sure to install the required values
pip install flask flask-jsonpify flask-sqlalchemy flask-restful
Then run the application with python server.py
I have my server running in the background on a raspberry pi that runs a cron job that curls the create playlist every monday