A FastAPI-based web application for downloading audio from websites with real-time progress tracking via WebSockets
- Browser Mode: Stream downloads directly to browser without server storage
- Server Mode: Password-protected downloads saved to server (for admin use)
- Real-time Progress: WebSocket-based live updates with detailed status
- Auto-detection: Automatically detects audio players on websites
- Parallel Downloads: Configurable workers for faster downloads (async)
- Multiple Formats: Supports MP3, M4A, AAC, OGG, OPUS, WebM, WAV, FLAC
- Smart Download Control: Prevents duplicate downloads across multiple tabs
- Job Tracking: Unique job IDs for all downloads with persistent tracking
- ✅ Direct audio tags
- ✅ Plyr.js audio players
- ❌ Howler.js (planned)
- ❌ MediaElement.js (planned)
- ❌ Video.js (planned)
- Clone the repository:
git clone <repository-url>
cd download_audio
git checkout containerized- Install dependencies:
pip install -r requirements.txt- Set environment variables (optional):
export ADMIN_PASSWORD="your-secure-password" # Default: admin123
export SECRET_KEY="your-secret-key" # For JWT tokens-
Copy the example environment file and fill in your actual values:
cp .env.example .env # Edit .env to set ADMIN_PASSWORD, SECRET_KEY, PORT, etc. -
Build and start the containers:
docker compose up --build -d
- Open
http://localhost:<YOUR_ENV_PORT_NUMBER>in your browser - Enter the URL of the page containing audio
- Leave "Download Mode" as "Browser"
- Click "Start Download"
- Files will stream directly to your browser as a ZIP
- Double Click AudioFetch title.
- Click on "Admin Login" and enter the admin password
- Select "Server" as the download mode
- Start the download - files will be saved on the server
- Access saved downloads from the "Server Downloads" section
The original command-line interface is still available:
python main.py <url> [name] [--plugin <plugin_name>] [--workers <num>]Example:
python main.py https://example.com/audiobook my-audiobook --plugin plyr --workers 10GET /- Web interfacePOST /api/download- Start a new downloadGET /api/status/{job_id}- Get job statusGET /api/jobs- List all jobsDELETE /api/jobs/{job_id}- Delete completed jobPOST /api/jobs/{job_id}/cancel- Cancel active jobGET /api/stream/{job_id}- Stream browser mode downloadWebSocket /ws- Real-time updates
POST /api/auth/login- Login with admin passwordGET /api/downloads- List server downloadsDELETE /api/downloads/{name}- Delete server downloadGET /api/downloads/{name}/zip- Download as ZIP
- WebSocket support for real-time updates
- JWT-based authentication for server mode
- Fully async/await download operations using aiohttp
- Background tasks for download processing
- True streaming ZIP generation (no buffering)
- Server-side download coordination for multiple tabs
- Vanilla JavaScript with WebSocket client
- Real-time progress bars with detailed status
- localStorage synchronization between tabs
- No framework dependencies
- User submits URL
- Backend analyzes page and detects audio player
- Extracts audio track information
- Creates streaming ZIP response
- Downloads and streams files directly to browser
- No server storage required
- Smart tab coordination prevents duplicate downloads
- User authenticates with admin password
- Backend downloads files asynchronously to server
- Real-time progress updates via WebSocket
- Files stored in
downloads/directory - User can download as ZIP later or manage files
ADMIN_PASSWORD: Password for server mode (default: "admin123")SECRET_KEY: JWT secret key (default: auto-generated)ACCESS_TOKEN_EXPIRE_MINUTES: Token expiry (default: 1440)
- Workers: 1-20 parallel downloads (default: 5)
- Timeout: 30 seconds per request
- Chunk size: 8KB for streaming
Logs are written to:
- Console output (INFO level)
audiofetch.logfile (DEBUG level)
Log format includes:
- Timestamp
- Log level
- Job ID (when applicable)
- Progress updates
- Error details
- Authentication: Server mode requires password
- CORS: Configure for production deployment
- File paths: Sanitized to prevent directory traversal
- Rate limiting: Built-in rate limits protect against abuse
- Login endpoint: 3 attempts per minute
- Download endpoint: 5 requests per minute
- HTTPS: Use reverse proxy with SSL in production
- Check firewall allows WebSocket connections
- Ensure reverse proxy forwards WebSocket headers
- Check browser console for errors
- Check
audiofetch.logfor details - Verify URL is accessible
- Check audio player is supported
- Ensure sufficient disk space (server mode)
- Support more audio players (Howler.js, Video.js)
- Browser extension
- Playlist support
- Metadata extraction and tagging