Photo: https://daily.bandcamp.com
A simple cli to create Spotify playlists from the audio of chapter enabled YouTube videos
I needed an automated process to transfer 80s synthwave mixes I listen to from YouTube, most of which were chapter enabled (new video feature from YT), to Spotify playlists.
This package relies on spotipy
, a lightweight python wrapper for Spotify api. See their docs for installation or Spotify developer guide for obtaining api keys
- clone this repo
$ git clone git@github.com:nickatnight/chaptify.git
andcd chaptify
- export ENV vars
$ export SPOTIFY_CLIENT_SECRET=<some_secret> $ export SPOTIFY_CLIENT_ID=<some_id> $ export SPOTIFY_REDIRECT_URI=<some_uri> # optional...defaults to http://localhost:8321
- install in editable mode
$ pip install -e .
- run
$ chaptify https://www.youtube.com/watch\?v\=Pz1a9MM-Vn4
- SPOTIFY_REDIRECT_URI environment variable must match the redirect URI added to your application in your Dashboard , this URI does not need to be accessible
- on first use,
spotipy
will spin up a temporary web server on whatever port is specified above to automatically handle the oauth redirect
Usage: chaptify [OPTIONS] URL
Youtube video link URL
Options:
-a, --append TEXT Append to a playlist (by name).
--help Show this message and exit.
This project uses Poetry to manage dev environment. Once installed:
- follow steps 1-2 from above
- install packages with
poetry install
- black
poetry run black .
- flake8
poetry run flake8
- test
poetry run pytest --cov=chaptify tests/
- build sdist
poetry build --format sdist
- create new setup.py
$ tar -xvf dist/*-`poetry version -s`.tar.gz -O '*/setup.py' > setup.py
- obviously, this tool is limited to whats available on Spotify
- only supports US market
- works best with title tracks with variations of "name - artist" eg Rosentwig - Journey
- there is no fancy algorithm or deep learning technique when using spotify search, just fetch me the first hit
Integrate with new libs