A blazing-fast HTTP API for downloading videos from YouTube with automatic cleanup, file serving, and a modern web interface!
This project provides a robust HTTP API for downloading videos from YouTube using yt-dlp, built with Rust and Axum for maximum performance and reliability.
|
Powered by yt-dlp with concurrent downloads and optimized performance settings. |
Direct HTTP access to downloaded files with secure path validation and streaming support. |
|
Beautiful, responsive web UI with video preview, download history, and drag-and-drop support. |
Choose video/audio quality, codecs, and format preferences through environment configuration. |
|
Automated cleanup of old downloads with configurable retention periods and scheduling. |
Smart video caching by YouTube ID - never download the same video twice! Instant returns for cached content. |
|
Detailed request tracking, error handling, and performance monitoring with structured logging. |
Unique job IDs for each request with full traceability from HTTP handler to download completion. |
- Rust (1.70 or later)
Snatchr includes a beautiful, modern web interface for easy video downloading!
Snatchr_WebUI.mp4
- 🎬 Instant Video Preview - Watch downloaded videos directly in the browser with our sleek video player
- 📋 Smart Download History - Keep track of all your previous downloads with timestamps and file info
- 🎨 Modern & Responsive - Beautiful design that works perfectly on desktop, tablet, and mobile
- ⚡ Lightning-Fast - Just paste a YouTube URL and watch your video download in seconds
- 🎯 One-Click Downloads - No complex settings, just pure simplicity and speed
- Start your Snatchr server
- Open your browser and navigate to
http://localhost:3000 - Paste any YouTube URL in the elegant input field
- Click "Download Video" and watch the magic happen!
- 📋 Clipboard Integration - Use the "Paste" button for instant URL pasting from your clipboard
- 🎬 Instant Preview - Downloaded videos appear immediately in the video player for instant gratification
- 📱 Mobile-First - The interface is optimized for mobile devices with touch-friendly controls
- 🔄 Auto-Refresh - The interface automatically updates to show your latest downloads
If you're running locally and your server is bound to 0.0.0.0, some browsers and extensions may block video playback. Use localhost in your browser URL instead of 0.0.0.0 for the best experience.
You can disable the web interface by setting the environment variable:
ENABLE_WEB_UI=falseWhen disabled, only the API endpoints will be available.
Download videos directly from your Apple device with our iOS Shortcut integration!
🔗 Download: Snatchr iOS Shortcut
-
Configure Server URL: After downloading, open the shortcut and update the
EXTERNAL_URLin the dictionary at the top- Include the
/downloadendpoint (e.g.,https://your-server.com/download)
- Include the
-
Codec Compatibility: For automatic saving to your photo gallery, ensure your Snatchr instance uses compatible codecs:
- Video:
AVC1(recommended) - Audio:
AAC(recommended)
- Video:
-
Alternative Save Method: If you experience issues with gallery saving, edit the shortcut and change
Save URL to RecentstoSave Fileinstead
Note: This shortcut is currently in beta. Please report any issues on our GitHub Issues page.
🐳 Deploy with Docker
1. Download the docker-compose.yml file or clone the repository:
git clone https://github.com/Valhalla-Development/Snatchr.git
cd Snatchr-
Review and modify the environment variables in docker-compose.yml if needed (PORT, DOWNLOAD_DIR, etc.)
-
Run with Docker Compose:
docker-compose up -d
-
The server will be available at http://localhost:3000
🚀 Build Locally (Rust)
1. Download the latest release or clone the repository:
git clone https://github.com/Valhalla-Development/Snatchr.git-
Navigate to the project directory:
cd Snatchr -
Install Rust (if not already installed):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Rename or copy the
.env.example>.envand fill in the required variables. -
Build the project:
cargo build --release
-
Run the server:
cargo run --release
curl -X POST "http://localhost:3000/download" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'Response:
{
"success": true,
"file_url": "http://localhost:3000/files/dQw4w9WgXcQ/file_name.mp4"
}The server automatically cleans up old downloads based on your CLEANUP_AFTER_MINUTES setting. Cleanup runs periodically in the background and logs all operations.
Snatchr features intelligent video caching that dramatically improves performance:
- Video ID Caching: Videos are stored using their YouTube video ID (e.g.,
dQw4w9WgXcQ) - Instant Returns: If a video is already cached, it's returned immediately without re-downloading
- Bandwidth Savings: Never download the same video twice
- Automatic Validation: Cached files are verified to ensure they're not corrupted
downloads/
├── dQw4w9WgXcQ/ # Video ID directory
│ └── video_title.mp4 # Cached video file
├── zwMEhBq4kYM/ # Another video ID
│ └── another_video.mp4
└── cache/ # System cache (preserved)
- First Download: Normal speed (downloads and caches)
- Subsequent Downloads: Instant! (returns cached file)
- Multiple Users: Share cached content across all users
- Server Efficiency: Reduced bandwidth and processing load
We welcome contributions to improve Snatchr! If you'd like to contribute:
- Fork the repository
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
- Make your changes and commit them with a clear, descriptive message:
git commit -m 'Add feature: brief description of your changes' - Push your changes to your fork:
git push origin feature/your-feature-name
- Open a Pull Request against the main repository's
mainbranch
Please ensure your code adheres to the project's coding standards and include tests for new features or bug fixes where applicable. We appreciate detailed descriptions in your Pull Request to help with the review process.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details. (It's mostly "Share the love, and keep it open!")
- yt-dlp for the powerful video download engine
- Axum for the high-performance web framework
- Tokio for the async runtime
- Rust for the blazing-fast and memory-safe foundation
- All contributors who help improve this project
We're constantly working to make Snatchr even better! Here's what we're cooking up:
- 🌐 Multi-Platform Support - Support for more video platforms beyond YouTube
Have a feature request or idea? We'd love to hear it! Open an issue or join our Discord to discuss.
Got questions or need help? Join our Discord server for support and to connect with other bot developers!
💻 Crafted with ❤️ by Valhalla-Development