This is a small script that lets you download tracks and playlists from Spotify directly from the command line. See below for installation and usage instructions and examples.
- Clone this repository.
git clone https://github.com/hassanaziz0012/spotify-downloader
- cd into the directory and run the following commands:
docker build -t spotify-downloader .
docker run -it -v your/music/folder:/app/music spotify-downloader
NOTE: Make sure to replace "your/music/folder"
with the actual directory where you keep your music. This is used to sync playlists and ignore tracks that already exist.
- Clone this repository.
git clone https://github.com/hassanaziz0012/spotify-downloader
# install python packages, including yt-dlp
pip install -r requirements.txt
# install ytfzf
git clone https://github.com/pystardust/ytfzf
cd ytfzf
sudo make install doc
I recommend using Docker to install and run this script.
- Firstly, open
config.json
and set your Spotify client ID and client secret. You can get this after creating a developer app on Spotify: https://developer.spotify.com/dashboard/create - If you installed via Docker, then run the container using the following command:
docker run -it -v your/music/folder:/app/music spotify-downloader
Replace your/music/folder
with your music directory.
- If you installed from source, then open
spotify-downloader.py
and change theOUTPUT_DIR
variable's value to your music directory.
python spotify-downloader track {TRACK_ID}
python spotify-downloader playlist {PLAYLIST_ID}
python spotify-downloader playlist {PLAYLIST_ID} -s
python spotify-downloader yt={YT_URL} track {TRACK_ID}
- Hassan Aziz
- Web Developer and Designer
- Website: https://www.hassandev.me
- Check out my other web projects
That's all, folks!