Skip to content

danguilherme/spotivy

Repository files navigation

Spotivy

Spotify music videos downloader

Application preview

Download all tracks from your Spotify playlists as videos or MP3.

How it Works

Spotivy gets the track information from Spotify and then search YouTube in the format of ${artist_name} - ${track_name}.

To decide which video to download from the returned list, it applies a very simple test for each item:

  • video was published by any VEVO affiliated channel?
  • video channel contains official in its name?
  • video contains official in its title?

If any of these assertions is true for the video being tested, this is the media that will be downloaded.

It's not precise, but it does the job 90% of the time. Any suggestion is welcome!

Configuration

  1. Install the CLI

    npm install -g spotivy
  2. Follow the instructions in the init command:

    spotivy init

    Basically, you'll need to create the keys to use Spotify and YouTube APIs, and configure the tool with them:

    1. Create an YouTube API key and put in the specified prompt.
    2. Create an application on Spotify Developers website, get the Client ID and Client Secret values, and do the same when requested by the tool.
    • Note: You can also pass the credentials in each command call:
    spotivy playlist danguilherme --spotify-client-id=clientid --spotify-client-secret=clientsecret --youtube-key=ytkey

Usage

spotivy help

Commands

Global Options

These options are accepted by any command.

Option Description Default
-o, --output Location where to save the downloaded media. ./media
-f, --format The format of the file to download. Either video or audio. video
-q, --quality The quality in which the video should be downloaded (ignored if --format=audio). Options: 144p, 240p, 360p, 720p, highest, lowest. highest
--flat Indicates if the files must be saved in one single folder (no subfolders). Useful if you're downloading multiple playlists. -
-a, --audio Flag to download as audio; equivalent to --format=audio. -
-v, --verbose Show detailed logs. -

Init

Configure the tool with the keys from Spotify and YouTube.

spotivy init

spotivy help init

Download playlists

Download any public playlists from a given user.

Accepts all global options.

spotivy playlist <username> [playlist_ids...] # user id and playlist id, zero or more
spotivy playlist danguilherme # download all public playlists from the user
spotivy playlist danguilherme 34X8sCTs81AWXD8hhbTZVn
spotivy playlist danguilherme 3BG5tkH8g77ClLThZiosGD 3Zpkeg6VE5wj5eghBxv0R6 -a # 2 playlists, audio only

spotivy help playlist

Download single tracks

Download any track you want by its Spotify ID.

Accepts all global options.

spotivy track <track...> # tracks list
spotivy track 5tXyNhNcsnn7HbcABntOSf
spotivy track 0SFJQqnU0k42NYaLb3qqTx 31acMiV67UgKn1ScFChFxo 52K4Nl7eVNqUpUeJeWJlwT 5tXyNhNcsnn7HbcABntOSf -a # 4 tracks, audio only

spotivy help track

License

Spotivy is under MIT License.