Skip to content

quinnjr/spotcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spotcli

A CLI tool that plays Spotify playlists through YouTube. No Spotify account required.

spotcli scrapes public playlist metadata from Spotify, finds matching tracks on YouTube via yt-dlp, and plays audio through mpv. It runs as a daemon controlled by simple CLI commands.

Install

cargo install --path .

Dependencies

spotcli needs yt-dlp and mpv on your system. Install them automatically:

spotcli setup

Or manually:

Platform yt-dlp mpv
Arch downloaded from GitHub sudo pacman -S mpv
Ubuntu/Debian downloaded from GitHub sudo apt install mpv
Fedora downloaded from GitHub sudo dnf install mpv
macOS downloaded from GitHub brew install mpv
Windows downloaded from GitHub winget install mpv

spotcli setup downloads the yt-dlp standalone binary from GitHub releases — no Python needed.

Usage

Play a playlist

spotcli play https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M

Spotify URIs also work:

spotcli play spotify:playlist:37i9dQZF1DXcBWIGoYBM5M

Shuffle and randomize

spotcli play <url> --shuffle                  # randomize track order
spotcli play <url> --start-track random       # start at a random track
spotcli play <url> --start-track 5            # start at track 5
spotcli play <url> --start-time               # start each track at a random position
spotcli play <url> --shuffle --start-time     # combine flags

Control playback

While a playlist is playing, use these from another terminal:

spotcli pause       # toggle pause/resume
spotcli next        # skip to next track
spotcli prev        # go to previous track
spotcli stop        # stop playback and exit

Check status

spotcli status
Track:    Bohemian Rhapsody - Queen
Album:    A Night at the Opera
Position: 2:34 / 5:55
State:    playing
Queue:    3 of 15 (shuffled)
spotcli queue
Queue: 15 tracks (shuffled)

     1. Another One Bites the Dust - Queen
     2. Don't Stop Me Now - Queen
 >   3. Bohemian Rhapsody - Queen
     4. Somebody to Love - Queen
     ...

Both support --json for machine-readable output:

spotcli status --json
spotcli queue --json

How it works

  1. Scrape — Fetches the public Spotify playlist page and extracts track metadata from embedded JSON (no API keys needed)
  2. Resolve — Searches YouTube for each track using yt-dlp. Resolves lazily — the next track is prefetched while the current one plays
  3. Play — Streams audio through mpv (no video). Communicates with mpv over its JSON IPC socket
  4. Control — The player listens on a Unix socket (or Windows named pipe). Control commands connect, send a JSON request, and print the response

Building from source

Requires Rust 1.85+ (edition 2024).

git clone <repo>
cd spotcli
cargo build --release

Run tests:

cargo test

License

MIT

About

Play Spotify playlists in the terminal via YouTube — no login required

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages