A web application for downloading YouTube videos with a web interface and CLI.
-
Clone the repository:
git clone https://github.com/yourusername/youtube-downloader.git cd youtube-downloader
-
Copy and configure environment:
cp .env.example .env # Edit .env if needed
-
Start the application:
make build docker-compose up
Access the web interface at http://localhost:8080
Build and run the CLI:
go build -o youtube-dl cmd/cli/main.go
./youtube-dl -url "https://www.youtube.com/watch?v=..."
-
Start the backend with hot-reloading:
make dev-backend
-
The API will be available at http://localhost:8080
-
Start the frontend with hot-reloading:
make dev-frontend
-
The frontend will be available at http://localhost:3000
Key environment variables:
# Server Configuration
PORT=8080 # Server port
ENV=development # Environment (development/production)
BASE_URL=http://localhost:8080 # Base URL for download links
# Storage
OUTPUT_DIR=/app/downloads # Video storage directory
TASK_RETENTION=24h # How long to keep videos
# Redis
REDIS_ADDR=redis:6379 # Redis server address
-
Download Video:
curl -X POST http://localhost:8080/api/download \ -H "Content-Type: application/json" \ -d '{"url": "https://www.youtube.com/watch?v=..."}'
-
Check Status:
curl http://localhost:8080/api/tasks/{task_id}
-
Download Video:
curl http://localhost:8080/videos/{task_id}
- Frontend: React.js
- Backend: Go with Chi router
- Queue: Redis with Asynq for concurrent task management
- Video Processing: yt-dlp
The application uses Asynq for background job processing, allowing you to:
- Download multiple videos simultaneously
- Monitor download progress in real-time
- Queue downloads when the system is busy
- Automatically retry failed downloads
Each download runs as a separate task in the queue, with status updates available through the API.
Access the task queue dashboard at http://localhost:8080/monitoring
-
Build production images:
make build
-
Deploy:
docker-compose up -d
For production, set appropriate environment variables in .env
, especially:
BASE_URL
for your public domainTASK_RETENTION
for video cleanupENV=production