A modern web application that allows users to search for songs on Spotify and automatically download them from YouTube, then seamlessly add them to your Navidrome music server. Perfect for building your personal music library with proper metadata, album art, and organized file structure.
- π΅ Search for songs using Spotify's rich database
- π₯ Automatic download from YouTube using metadata
- π·οΈ Automatic ID3 tagging with artist, album, album art, and metadata
- π Direct upload to Navidrome server or local downloads
- π¨ Modern, clean web interface with download queue
- β‘ Real-time download status updates with progress bars
- π Visual download queue showing all active downloads
- π Choose between local downloads (browser) or Navidrome server upload
- Frontend: Vanilla JavaScript, HTML, CSS
- Backend: Python FastAPI
- Spotify API: For searching and getting track metadata
- yt-dlp: For downloading audio from YouTube
- mutagen: For ID3 tagging
- Navidrome: Music server integration
For Docker (Recommended):
- Docker and Docker Compose
- Spotify API credentials (Get them here)
For Manual Installation:
- Python 3.8+ (Python 3.11 recommended, avoid 3.13 due to compatibility issues)
- FFmpeg (required by yt-dlp for audio conversion)
- Spotify API credentials (Get them here)
- Navidrome server (optional, for direct server uploads)
Just 3 steps:
# 1. Clone the repo
git clone https://github.com/soggy8/music-downloader.git
cd music-downloader
# 2. Setup environment (add your Spotify credentials)
cp backend/env.example backend/.env
# Edit backend/.env and add your SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET
# 3. Run it!
docker-compose up -dOpen http://localhost:8000 in your browser. Done! π
Note: If you want to use Navidrome, edit
docker-compose.ymlto mount your Navidrome music directory. See DOCKER.md for details.
See SETUP.md for detailed setup instructions.
git clone <your-repo-url>
cd musicDownloadercd backend
pip install -r requirements.txtOr use a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtUbuntu/Debian:
sudo apt update
sudo apt install ffmpegmacOS:
brew install ffmpegWindows: Download from FFmpeg website and add to PATH
Create a .env file in the backend directory:
# Spotify API Configuration
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
SPOTIFY_REDIRECT_URI=http://localhost:8000/callback
# Navidrome Configuration
NAVIDROME_MUSIC_PATH=/path/to/navidrome/music
NAVIDROME_API_URL=http://localhost:4533
NAVIDROME_USERNAME=admin
NAVIDROME_PASSWORD=password
# Download Configuration
OUTPUT_FORMAT=mp3
AUDIO_QUALITY=128
# API Configuration
API_HOST=0.0.0.0
API_PORT=8000
CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000- Go to Spotify Developer Dashboard
- Create a new app
- Copy the Client ID and Client Secret
- Add
http://localhost:8000/callbackto Redirect URIs (optional for client credentials flow)
Set NAVIDROME_MUSIC_PATH to the directory where Navidrome stores its music library. This path must be:
- Writable by the user running the backend
- Accessible (local filesystem, NFS mount, or similar)
cd backend
python app.pyOr with uvicorn directly:
cd backend
uvicorn app:app --host 0.0.0.0 --port 8000 --reloadThe application (both frontend and API) will be available at http://localhost:8000
The frontend is automatically served from the backend, so no separate frontend server is needed.
- Open the web interface in your browser (http://localhost:8000)
- Choose download location: "My Downloads Folder" or "Navidrome Server"
- Search for a song, artist, or album
- Browse the search results
- Click "Download" on any track you want
- Watch the progress in the download queue at the top
- Downloads complete automatically:
- Local downloads: Files are saved to your browser's Downloads folder
- Navidrome uploads: Files are added to your Navidrome library (Artist/Album structure)
- Search: Uses Spotify API to search for tracks and get rich metadata
- Download: Uses yt-dlp to search YouTube and download audio
- Tagging: Applies ID3 tags using metadata from Spotify (title, artist, album, cover art)
- Upload: Copies the file to Navidrome's music directory in organized folders (Artist/Album/)
- Scan: Optionally triggers Navidrome to scan for new files (if API credentials are configured)
-
POST /api/search- Search for tracks on Spotify- Body:
{ "query": "search term", "limit": 20 }
- Body:
-
GET /api/track/{track_id}- Get details for a specific track -
POST /api/download- Start downloading a track- Body:
{ "track_id": "spotify_track_id", "location": "local" | "navidrome" }
- Body:
-
GET /api/download/status/{track_id}- Get download status -
GET /api/health- Health check endpoint
music-downloader/
βββ backend/
β βββ app.py # FastAPI main application
β βββ config.py # Configuration management
β βββ requirements.txt # Python dependencies
β βββ env.example # Environment variables template
β βββ services/
β β βββ spotify.py # Spotify API integration
β β βββ youtube.py # YouTube download with yt-dlp
β β βββ metadata.py # ID3 tagging
β β βββ navidrome.py # Navidrome integration
β βββ utils/
β βββ file_handler.py # File operations
βββ frontend/
β βββ index.html # Main HTML page
β βββ styles.css # Styling
β βββ app.js # Frontend JavaScript
βββ images/ # Screenshots and images for README
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Docker Compose configuration
βββ DOCKER.md # Docker deployment guide
βββ DEPLOYMENT.md # Server deployment guide
βββ SETUP.md # Manual setup guide
βββ README.md # This file
- Make sure your Client ID and Secret are correct
- Check that you've created an app in the Spotify Developer Dashboard
- Ensure FFmpeg is installed and in your PATH
- Check your internet connection
- Some videos may be region-locked or unavailable
- Verify
NAVIDROME_MUSIC_PATHis correct and writable - Check file permissions on the Navidrome music directory
- Ensure the path exists
- Update
CORS_ORIGINSin.envto include your frontend URL - Make sure the frontend is accessing the correct API URL
- This tool is for personal use only
- Respect copyright laws in your jurisdiction
- Spotify API Terms of Service apply
- YouTube Terms of Service apply
- Use responsibly and ethically
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Music Downloader is a full-stack web application designed to streamline the process of adding music to your Navidrome server. By leveraging Spotify's comprehensive music database for search and metadata, and YouTube as the audio source, it provides a seamless way to discover and download music with proper ID3 tags, album artwork, and organized folder structure.
Key Benefits:
- π Fast & Efficient: Single-click downloads with automatic processing
- π Rich Metadata: Complete ID3 tags from Spotify (artist, album, year, genre, artwork)
- ποΈ Auto-Organization: Files automatically organized in Artist/Album/ structure
- π Auto-Sync: Automatically triggers Navidrome library scans
- π» Self-Hosted: Full control over your data and downloads
- π¨ Modern UI: Clean, responsive web interface with visual download queue
- π₯ Dual Download Options: Choose between local browser downloads or direct Navidrome server upload
- π Progress Tracking: Real-time progress bars and status updates for all downloads
- π³ Docker Ready: One-command deployment with Docker Compose
Perfect for music enthusiasts who want to expand their Navidrome library quickly and efficiently!
- DOCKER.md - Docker deployment guide
- DEPLOYMENT.md - Production server deployment guide
- SETUP.md - Manual installation guide