Skip to content

📖 ➡️ 🔊 Create Spotify playlists from the audio of chapter enabled YouTube videos

Notifications You must be signed in to change notification settings

nickatnight/chaptify

Repository files navigation

Synthwave Photo: https://daily.bandcamp.com

GitHub Actions status

chaptify 📕 🔈

A simple cli to create Spotify playlists from the audio of chapter enabled YouTube videos

Reason?

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.

Install (edit mode) Python 3.9+

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

  1. clone this repo $ git clone [email protected]:nickatnight/chaptify.git and cd chaptify
  2. 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
  3. install in editable mode $ pip install -e .
  4. run $ chaptify https://www.youtube.com/watch\?v\=Pz1a9MM-Vn4

Note

  • 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

Usage: chaptify [OPTIONS] URL

  Youtube video link URL

Options:
  -a, --append TEXT  Append to a playlist (by name).
  --help             Show this message and exit.

cli demo

Development

This project uses Poetry to manage dev environment. Once installed:

  1. follow steps 1-2 from above
  2. install packages with poetry install
  3. black poetry run black .
  4. flake8 poetry run flake8
  5. test poetry run pytest --cov=chaptify tests/
  6. build sdist poetry build --format sdist
  7. create new setup.py
    $ tar -xvf dist/*-`poetry version -s`.tar.gz -O '*/setup.py' > setup.py

Limitations

  • 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

TODO

Integrate with new libs

About

📖 ➡️ 🔊 Create Spotify playlists from the audio of chapter enabled YouTube videos

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages