View your Spotify Top Tracks in a Playlist, Top Played Artists, & More!
- Generate Top Tracks Playlist that auto-updates!
- Generate List of Top Played Artists
- Generate Reccomended Tracks Playlists (Optional)
- Optional Apprise Alerts/Notifications
- Docker Support
- Google Sheets Compatiable.
- Keep_Alive Flask Server
To run this project, you will need to add the following environment variables to your .env file (see .env.example for a reference):
Environment Variable | Description | Default Value |
---|---|---|
CLIENT_ID |
Found on Spotify Developer Dashboard. More Info | - |
SECRET_CLIENT_ID |
Found on Spotify Developer Dashboard. More Info | - |
REDIRECT_URL |
The Redirect URL you added when creating the App on Spotify's Developer Dashboard. Check .env.example for reference. | - |
USERNAME |
Your Spotify account username (can be found in Spotify account settings.) | - |
Environment Variable | Description | Default Value |
---|---|---|
MINUTES |
Number of minutes the program should wait before updating Top Tracks playlist. | 360 minutes (or 6 hours) |
PUBLIC_PLAYLIST |
Boolean value indicating whether to create a public playlist. | True |
RECOMMENDATIONS |
Boolean value indicating whether to generate recommendations (tracks playlist and artists recommendations). | False |
KEEP_ALIVE |
Whether to run the flask server or not to keep the program from sleeping on replit. | False |
APPRISE_ALERTS |
Full list of services and their URLs available here: Apprise Wiki | - |
TZ |
Your desired Time-Zone. Should be formatted from the IANA TZ Database. | America/New York |
AUTH_CACHE |
Cache JSON String retrieved from initial setup, for hosting 24/7 on Render or other platforms for free. | - |
GSPREAD_KEYS |
Your Google Service Account JSON contents obtained via OAuth 2.0 Client ID in Credentials of Google Cloud API. | - |
-
Go to Spotify Developer's Dashboard. Log in using your Spotify credentials.
-
Create a new Application. Name it as desired, add any description, and agree to the Terms of Service.
-
Click on 'Edit Settings' and add the redirect URL you've set in your
.env
file, then save. Examples: -
Click 'Show Client Secret'.
-
Copy/paste the Client ID into
CLIENT_ID
and the Secret Client ID intoSECRET_CLIENT_ID
within your.env
file.
- Sign into the Google Cloud Console, create your APP, and enable Google Sheets and Google Drive APIs.
- Go to API & Services -> Credentials -> Create Credentials -> Service Account. Follow the prompts and download the JSON file afterward.
- Open Google Sheets and create a new file named 'Wrapped365'. Add tabs named 'short_term', 'medium_term', 'long_term', 'short_term Artists', 'medium_term Artists', and 'long_term Artists'.
- Share the Google Sheet Document with the email of your service account, giving editor permissions. The email can be found in Google's Cloud Console Credentials or within the downloaded JSON file, resembling something like:
wrapped-test@wrapped-test943892.iam.gserviceaccount.com
.
This script can be used locally or using Docker.
Clone the repository & Install dependencies
git clone https://github.com/Prem-ium/Spotify-Wrapped-365.git
cd Spotify-Wrapped-365
pip install -r requirements.txt
Finally, you're ready to run the script!
python main.py
-
Run script locally with Python & generate cache file.
-
Download and install Docker on your system
-
Configure your
.env
file (See below and example for options) -
To build the image, cd into the repository and run:
docker build -t spotify-wrapped .
Then start the bot with:
docker run -it --env-file ./.env --restart unless-stopped --name spotify-wrapped spotify-wrapped
-
Let the bot log in and begin working. DO NOT PRESS
CTRL-c
. This will kill the container and the bot. To exit the logs view, pressCTRL-p
thenCTRL-q
. This will exit the logs view but let the bot keep running.
This repository is using the MIT license.
- GitHub Actions Support (Currently Not Working-> ISSUE: Spotipy Access token is able to be refreshed, but cannot be updated to GitHub Secrets for next run)
I've been working on this project for a few months now, and I'm really happy with how it's turned out. It's also been a helpful tool for users to view their music data. If you appreciate my work and would like to show your support, there are two convenient ways to make a donation:
-
GitHub Sponsors
- Donate via GitHub Sponsors
- This is the preferred donation method as you can place donations with no transaction fees & possibily receive perks for your donation.
-
Buy Me A Coffee
Your generous donations will go a long way in helping me cover the expenses associated with developing new features and promoting the project to a wider audience. I extend my heartfelt gratitude to all those who have already contributed. Thank you for your support!