A comprehensive, user-friendly Python wrapper script for SpotDL v4 that simplifies downloading music from Spotify with an interactive menu system and advanced error handling.
- Features
- Prerequisites
- Installation Guide
- Quick Start
- Main Menu Options
- Script Workflow
- Advanced Usage
- Troubleshooting
- SpotDL Documentation
- Disclaimer
- π― Interactive Menu System: Easy-to-use command-line interface
- π Smart Directory Management: Automatic output directory creation and validation
- π΅ Multiple Audio Formats: Support for MP3, M4A, FLAC, OPUS, WAV, AAC
- β‘ Concurrent Downloads: Configurable multi-threaded downloading
- π Metadata Embedding: Automatic lyrics, album art, and track information
- π Playlist Synchronization: Keep local playlists in sync with Spotify
- β Error Handling: Comprehensive error detection and reporting
- π Download Summaries: Detailed reports of successful and failed downloads
- ποΈ Advanced Options: Support for custom FFmpeg and yt-dlp arguments
Before using this script, ensure you have:
- Python 3.7 or higher installed on your system
- Git (optional, for cloning repositories)
- Internet connection for downloading dependencies and music
- Spotify account (free or premium) for accessing track metadata
For Windows:
# Navigate to your desired directory
cd "C:\Users\YourUsername\Music\SpotDL"
# Create virtual environment
python -m venv spotdl_env
# Activate virtual environment
spotdl_env\Scripts\activateFor macOS/Linux:
# Navigate to your desired directory
cd ~/Music/SpotDL
# Create virtual environment
python3 -m venv spotdl_env
# Activate virtual environment
source spotdl_env/bin/activate# Ensure your virtual environment is activated (you should see (spotdl_env) in your prompt)
pip install --upgrade pip
pip install spotdlSpotDL requires FFmpeg for audio processing. You have two options:
Option A: Let SpotDL install FFmpeg (Recommended)
spotdl --download-ffmpegOption B: Install FFmpeg system-wide
- Windows: Download from FFmpeg official site or use
winget install FFmpeg - macOS: Use Homebrew:
brew install ffmpeg - Linux: Use package manager:
sudo apt install ffmpeg(Ubuntu/Debian) orsudo yum install ffmpeg(CentOS/RHEL)
Save the spotdl_downloader.py file to your SpotDL directory, or copy the script content into a new file.
# Test SpotDL installation
spotdl --version
# Test FFmpeg installation
ffmpeg -version-
Activate your virtual environment:
# Windows spotdl_env\Scripts\activate # macOS/Linux source spotdl_env/bin/activate
-
Run the script:
python spotdl_downloader.py
-
Follow the interactive menu to download your favorite music!
--- spotDL v4 User-Friendly Downloader Script ---
1. Download Songs (from Spotify URLs)
2. Save Metadata (generate .spotdl files for tracks/playlists)
3. Sync Playlist/Album (download new, remove deleted from local)
4. Get Direct Download URLs (view source URLs without downloading audio)
5. Exit
- Purpose: Download individual tracks, albums, playlists, or artist discographies
- Input: Spotify URLs (space or newline separated)
- Features:
- Choose output directory
- Select audio format (MP3, M4A, FLAC, etc.)
- Configure bitrate (0 for highest quality, 320k, 256k, etc.)
- Enable/disable lyrics and metadata embedding
- Set concurrent download threads
- Handle existing files (skip, force overwrite, update metadata)
- Purpose: Generate
.spotdlfiles containing track metadata without downloading audio - Use Case: Create playlists for future batch downloads or sharing
- Output:
.spotdlfiles that can be used with sync functionality
- Purpose: Keep local music collection synchronized with Spotify playlists
- Features:
- Download new tracks added to playlist
- Remove local files for tracks removed from playlist
- Use existing
.spotdlfiles for faster synchronization - Maintain playlist organization
- Purpose: Retrieve direct download links without downloading audio files
- Use Case: Integration with external download managers or automation scripts
graph TD
A[Start Script] --> B[Display Welcome Message]
B --> C[Show Initial Setup Checklist]
C --> D[Display Main Menu]
D --> E{User Choice}
E -->|1| F[Download Songs]
E -->|2| G[Save Metadata]
E -->|3| H[Sync Playlist]
E -->|4| I[Get URLs]
E -->|5| J[Exit]
F --> K[Get Spotify URLs]
K --> L[Configure Download Options]
L --> M[Execute SpotDL Command]
M --> N[Parse Output & Show Results]
N --> D
G --> O[Get URLs & Save File]
O --> P[Execute Save Command]
P --> D
H --> Q[Get Sync Source]
Q --> R[Configure Sync Options]
R --> S[Execute Sync Command]
S --> T[Show Sync Results]
T --> D
I --> U[Get URLs for Direct Links]
U --> V[Execute URL Command]
V --> D
# Example directory structure the script can create:
Music/
βββ Downloads/
β βββ Playlists/
β β βββ My Playlist/
β βββ Albums/
β β βββ Artist - Album Name/
β βββ Singles/
βββ Metadata/
βββ playlist_backup.spotdlThe script supports passing custom arguments to SpotDL:
- FFmpeg Arguments:
--ffmpeg-args "-vn -loglevel quiet" - yt-dlp Arguments:
--yt-dlp-args "--no-check-certificate" - Custom Search Queries: Override Spotify matching with manual search terms
For large playlists or multiple operations:
- Use the Save Metadata option first to create
.spotdlfiles - Use Sync Playlist with the saved files for faster processing
- Enable archive files to avoid re-downloading existing tracks
β "spotdl command not found"
- Ensure your virtual environment is activated
- Verify SpotDL installation:
pip list | grep spotdl - Reinstall SpotDL:
pip install --upgrade spotdl
β "FFmpeg not found"
- Run
spotdl --download-ffmpegin your activated environment - Or install FFmpeg system-wide (see installation guide)
β "Could not find a match for song"
- Try using custom search queries
- Check if the track is available in your region
- Verify the Spotify URL is correct and accessible
β "AudioProviderError"
- Usually indicates YouTube source issues
- Try downloading individual tracks instead of large batches
- Check your internet connection
β Permission errors on Windows
- Run command prompt as Administrator
- Check if antivirus is blocking the downloads
- Ensure the output directory is writable
- Check SpotDL logs for detailed error information
- Review the output displayed by the script
- Visit the issues section of the SpotDL GitHub repository
- Update SpotDL to the latest version:
pip install --upgrade spotdl
For more detailed information about SpotDL v4:
- π Official Documentation: SpotDL v4 Docs
- π GitHub Repository: SpotDL/spotify-downloader
- π Release Notes: Latest Releases
- β Community Support: GitHub Discussions
- Configuration Files: Learn about
.spotdl.ymlconfiguration - CLI Reference: Complete command-line interface documentation
- API Usage: Programmatic usage of SpotDL
- Plugin Development: Extending SpotDL functionality
This script and SpotDL are intended for educational and personal use only. Please be aware of the following:
- π Respect Copyright Laws: Only download music you have the legal right to download
- π Terms of Service: Ensure compliance with Spotify's Terms of Service
- π Regional Restrictions: Respect geographical content restrictions
- π Personal Use: Downloads should be for personal, non-commercial use only
- π° Support Artists: Consider purchasing music or streaming subscriptions to support artists
- The authors of this script are not responsible for any misuse or legal issues arising from its use
- Users are solely responsible for ensuring their usage complies with applicable laws and regulations
- This tool is provided "as-is" without any warranties or guarantees
- π΅ Use Premium Accounts: Support the music industry with legitimate subscriptions
- π Keep Records: Maintain documentation of your legal music library
- π Regular Updates: Keep SpotDL updated for the best experience and security
- π‘οΈ Backup Important Data: Always backup your music library and metadata files
Made with β€οΈ for music lovers who want a better download experience.
For issues, suggestions, or contributions, please refer to the SpotDL GitHub repository.