Downloads audio from YouTube based on Spotify metadata
This project is for educational and testing purposes only. Please respect artists' rights and do not use this tool for copyright infringement. Support artists by purchasing their music or using legitimate streaming services.
spotdl uses Spotify's API to fetch metadata (song name, artist, album) and then searches YouTube for the matching audio to download.
Downloaded files will be saved to the ./Songs directory. You can change this in Output directory.
- Python 3.8 or higher
- ffmpeg (required for audio conversion)
macOS:
brew install ffmpegLinux (Ubuntu/Debian):
sudo apt update
sudo apt install ffmpegWindows: Download from https://ffmpeg.org/download.html or use:
choco install ffmpeg-
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
- macOS/Linux:
source venv/bin/activate - Windows:
venv\Scripts\activate
- macOS/Linux:
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
cp .env.example .env
Then edit
.envand add your credentials:- Go to https://developer.spotify.com/dashboard
- Create an app
- Copy your Client ID and Client Secret
- Paste them into
.envfile
-
Run the script:
python spotify_downloader.py
When you're done, deactivate the virtual environment:
deactivateEdit .env file and update:
SPOTIFY_CLIENT_ID- Your Spotify Client IDSPOTIFY_CLIENT_SECRET- Your Spotify Client SecretSPOTIFY_URL- The Spotify URL you want to downloadOUTPUT_DIR- Where to save downloaded files (default:./Songs)
Supported URLs:
- Single track:
https://open.spotify.com/track/... - Album:
https://open.spotify.com/album/... - Playlist:
https://open.spotify.com/playlist/...