Coder Social home page Coder Social logo

lukethacoder / spotify-playlist-backup Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 1.0 624 KB

๐ŸŽต Scheduled Python script to backup your personal Spotify playlists incase the platform ever goes down (or you just like having your data).

Home Page: https://blog.lukesecomb.digital/article/spotify-playlist-backup-using-github-actions

License: GNU General Public License v3.0

Python 100.00%
spotify spotify-backup spotify-developers cron spotify-api

spotify-playlist-backup's Introduction

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. Make sure http://localhost:3000/callback is set as a Redirect URI.

# .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

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.

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.

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 tool to calculate when and how often you want to run the Github Action.

spotify-playlist-backup's People

Contributors

lukethacoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rhy0lite

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.