Automate saving your Discover Weekly Playlist using Python.
Made with <3 and FastAPI.
The saved playlist link is sent to my discord server via a webhook.
Clone this repository.
git clone https://github.com/shouryade/SpotWeeklyThis project uses pipenv to create a virtual environment.
pip install pipenvActivate and install dependencies using pipenv.
cd SpotWeekly
pipenv install For venv enthusiasts, I have provided a requirements.txt file to help install project dependencies.
Rename the env.example file to .env.
Registering Your Spotify App on Spotify for Developers
Setting up webhook for Discord
To get the playlist ID for your Discover Weekly, copy the link for the playlist.
The highlighted portion as shown in the image is the Spotify Playlist ID.

Extract the ID and paste it onto the .env file.
Fill the remaining details in the .env file.
Run app.py and copy the token supplied.
Run main.py and supply the parameters asked.
Check Discord once Successfully created playlist ! is printed on screen.
A Cron job is used to schedule events without human interaction.
Here I have used the following cronjob to run the FastAPI server.
0 10 * * 1 /usr/bin/python ~/SpotWeekly/app.py
which basically translates to run app.py at 10:00 AM every Monday.
You can modify the scheduled job according to your convenience using https://crontab.guru.
Now,follow the given instructions :
- In the terminal, type
crontab -e. This launches Vi Editor. - Press
ito launchedit mode. - Copy the text in
cron.txtand paste it in the crontab file. - Type
:wqto exit the editor and save changes. - You should see
crontab: installing new crontab.
[ ] Create Docker instance.
[ ] Run this as a cron job using Github Workflows.
[ x ] Create a cron job if locally deployed.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.