A Python application that downloads songs from Spotify playlists, albums, or your liked songs as MP3 files (or other audio formats). The tool searches for each track on YouTube and downloads the audio in your preferred format and quality. It features both a command-line interface and a web interface for easier use.
- Download entire Spotify playlists, albums, or your liked songs
- Concurrent downloads for faster processing
- Configurable audio format (MP3, M4A, WAV)
- Adjustable audio quality (128kbps to 320kbps)
- Progress bar with download status
- Graceful handling of interruptions
- Automatic retry mechanism for failed downloads
- Multithreaded YouTube URL fetching
- Web interface for easier use
- Batch mode for downloading multiple playlists/albums at once
- Real-time progress tracking
- Custom download location support
-
Python 3.9+
-
FFmpeg installed on your system
-
Required Python packages (install via pip):
pip install -r requirements.txt
-
Clone the repository:
git clone https://github.com/sarthak2143/spotify-dl.git cd spotify-dl
-
Create a Spotify Developer account and get your credentials:
- Go to Spotify Developer Dashboard
- Create a new application
- Get your Client ID and Client Secret
- Add
http://localhost:5000/callback
to your Redirect URIs in the app settings
-
Create a
config.json
file in the project directory:{ "CLIENT_ID": "your_client_id_here", "CLIENT_SECRET": "your_client_secret_here", "REDIRECT_URI": "http://localhost:5000/callback" }
The application can be used in two ways: through the command-line interface or web interface.
# Download a playlist
python main.py "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
# Download an album
python main.py "https://open.spotify.com/album/1DFixLWuPkv3KT3TnV35m3"
# Download your liked songs
python main.py "liked"
# Limit the number of songs to download (e.g., first 10 songs)
python main.py "playlist_url" -l 10
# Specify audio format (mp3, m4a, or wav)
python main.py "playlist_url" -f m4a
# Set audio quality (128, 192, 256, or 320 kbps)
python main.py "playlist_url" -q 320
# Combine multiple options
python main.py "playlist_url" -l 5 -f mp3 -q 320
url
: Spotify playlist/album URL or 'liked' for your liked songs-l, --limit
: Limit the number of songs to download-f, --format
: Audio format (mp3, m4a, wav)-q, --quality
: Audio quality in kbps (128, 192, 256, 320)
The web interface provides an easier way to download Spotify content with a user-friendly UI and real-time progress tracking.
python app.py
This will start a Flask web server on port 5001. Open your browser and navigate to:
http://localhost:5001
- Enter a Spotify URL in the input field (playlist, album, or type "liked" for your liked songs)
- Choose your preferred audio format and quality
- Optionally specify a custom download location and limit
- Toggle "Batch Mode" to download multiple playlists/albums at once (enter one URL per line)
- Click "Download" and monitor the progress in real-time
- yt-dlp for YouTube downloading functionality
- spotipy for Spotify API integration
- youtube-search-python for YouTube search functionality
- Flask for the web interface