Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukethacoder/spotify-playlist-backup
🎵 Scheduled Python script to backup your personal Spotify playlists incase the platform ever goes down (or you just like having your data).
https://github.com/lukethacoder/spotify-playlist-backup
cron spotify spotify-api spotify-backup spotify-developers
Last synced: 11 days ago
JSON representation
🎵 Scheduled Python script to backup your personal Spotify playlists incase the platform ever goes down (or you just like having your data).
- Host: GitHub
- URL: https://github.com/lukethacoder/spotify-playlist-backup
- Owner: lukethacoder
- License: gpl-3.0
- Created: 2022-07-05T06:31:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-17T23:45:03.000Z (over 1 year ago)
- Last Synced: 2024-10-11T13:27:35.181Z (27 days ago)
- Topics: cron, spotify, spotify-api, spotify-backup, spotify-developers
- Language: Python
- Homepage: https://blog.lukesecomb.digital/article/spotify-playlist-backup-using-github-actions
- Size: 609 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![](./docs/banner.jpg)
Scheduled Python script to backup your personal Spotify playlists incase the platform ever goes down (or you just like having your data).
## Environemnt Variables
You can get Spotify `CLIENT_ID` and `CLIENT_SECRET` values from setting up your own [Spotify Developer Application](https://developer.spotify.com/dashboard/applications). Make sure `http://localhost:3000/callback` is set as a Redirect URI.
![](./docs/spotify-developer-app-dashboard.jpg)
```
# .env file
# Values from your Spotify Developer Application
SPOTIFY_CLIENT_ID=laboriselitutenimdoculpa
SPOTIFY_CLIENT_SECRET=laboriselitutenimdoculpa# Your Spotify Username
SPOTIFY_USERNAME=12345678910# Your Spotify Password
SPOTIFY_PASSWORD=abcdefghijklmnopqrstuvwxyz# Comma separated list of usernames of playlist authors.
# This allows you to back up other peoples playlists (that you follow) if you want.
# if left blank, all of your followed/created playlists will be backed up.
SPOTIFY_OWNER_IDS=snoopdogg,drdre,spotify
```## Run the script
```cmd
python script.py
```> Under the hood this is running a headless browser to authenticate your user. Once the access token has been fetched, it is then used to query for your playlists and subsequently the tracks within those playlists.
## Github Action Setup
Before your Github Action will run successfully, you must setup the above `.env` variables correctly within the repo.
![](./docs/github-actions-secrets-setup.jpg)
Once setup, you can manually run the job via the `Actions` tab.
### Automated CRON Job
By default, the CRON Job Github Action is disabled. To enable this within your repo, open the `.github/workflows/python-app.yml` file and uncomment the schedule code block.
```yaml
on:
# schedule:
# - cron: '0 3 * * 2'
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
```> You can use the [crontab](https://crontab.guru/) tool to calculate when and how often you want to run the Github Action.