A modular, cross-platform video downloader built with Rust.
- Memory Safe - Built with Rust for zero-cost abstractions
- Cross-Platform - Linux, macOS, Windows, Android (Termux)
- Extensible Architecture - Plugin system for new platforms
- Multiple Protocols - MP4, M3U8 (HLS), MPD (DASH)
- Progress Tracking - Real-time download progress
- Format Selection - Automatic or manual quality selection
| Platform | Status | Extractor |
|---|---|---|
| YouTube | β Active | src/extractors/youtube/mod.rs |
| β Active | src/extractors/instagram/mod.rs |
|
| Twitter/X | β Active | src/extractors/twitter/mod.rs |
| Vimeo | β Active | src/extractors/vimeo/mod.rs |
| β Active | src/extractors/facebook/mod.rs |
|
| Generic | β Fallback | Built-in generic extractor |
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Verify
rustc --version
cargo --versioncd vdl
cargo build --release./target/release/vdl <URL>vdl/
βββ src/
β βββ lib.rs # Library exports
β βββ main.rs # CLI entry point
β βββ downloader.rs # HTTP download logic
β βββ extractor.rs # Base extraction trait
β βββ formats.rs # Format handling
βββ examples/ # Usage examples
βββ Cargo.toml # Dependencies
βββ README.md
Add to your Cargo.toml:
[dependencies]
vdl = { path = "path/to/vdl" }Basic usage:
use vdl::{Downloader, VideoInfo};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let downloader = Downloader::new();
// Extract video info
let info = downloader.extract("https://example.com/video").await?;
// Download best quality
downloader.download(&info.formats.best, "video.mp4").await?;
Ok(())
}Implement the Extractor trait:
use async_trait::async_trait;
use crate::{Extractor, VideoInfo, VideoFormat};
pub struct MyPlatformExtractor;
#[async_trait]
impl Extractor for MyPlatformExtractor {
async fn extract(&self, url: &str) -> Result<VideoInfo, Error> {
// Your extraction logic here
Ok(VideoInfo {
id: "video_id".to_string(),
title: "Video Title".to_string(),
formats: vec![VideoFormat {
id: "best".to_string(),
url: "https://cdn.com/video.mp4".to_string(),
quality: 1080,
..Default::default()
}],
})
}
fn supports(&self, url: &str) -> bool {
url.contains("myplatform.com")
}
}Register in extractor.rs:
pub fn register_extractors() -> Vec<Box<dyn Extractor>> {
vec![
Box::new(YouTubeExtractor),
Box::new(MyPlatformExtractor),
// Add more...
]
}# Basic download (auto-detects platform)
vdl "https://youtube.com/watch?v=..."
vdl "https://instagram.com/p/..."
vdl "https://twitter.com/.../status/..."
vdl "https://vimeo.com/..."
vdl "https://facebook.com/..."
# Specify output file
vdl "https://youtube.com/watch?v=..." -o my_video.mp4
# Quality selection
vdl "https://vimeo.com/..." -q 1080
vdl "https://instagram.com/p/..." -q 720
# List available formats
vdl "https://youtube.com/watch?v=..." --list-formats
# Silent mode (no output)
vdl "https://facebook.com/video" -q# YouTube
./vdl "https://youtube.com/watch?v=dQw4w9WgXcQ"
# Instagram Post
./vdl "https://instagram.com/p/C5qK8vJvFPH/"
# Instagram Story
./vdl "https://instagram.com/stories/username/"
# Twitter Video
./vdl "https://twitter.com/user/status/123456789"
# Vimeo
./vdl "https://vimeo.com/123456789"
# Facebook Video
./vdl "https://facebook.com/video/posts/123456789"Download pre-built browser binaries from GitHub Releases:
vdl.wasm- WebAssembly for browsersvdl.js- JavaScript wrappervdl.node- Node.js native module
// Download video in browser
import { VDL } from './vdl.js';
await VDL.download('https://youtube.com/watch?v=XXX');VDL can be deployed as a web service for browser-based video downloading:
cd api
cargo build
cargo runEndpoints:
GET /download/:url # Download video by URL
// Frontend JavaScript
async function downloadVideo(url) {
const response = await fetch(`http://localhost:8080/download/${encodeURIComponent(url)}`);
const result = await response.json();
console.log(result);
}βββββββββββββββββββββββββββββββββββββββββββ
β CLI/Application β
ββββββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββ
β Downloader Interface β
β - Extract video info β
β - Select optimal format β
β - Download with progress β
ββββββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββ
β Extractor Router β
β - URL β Platform detection β
β - Route to appropriate extractor β
ββββββββββββββββββββ¬βββββββββββββββββββββββ
β
βββββββββββββββ΄ββββββββββββββ
β β
ββββββΌβββββ ββββββΌβββββ
βYouTube β βGeneric β
βExtractorβ βExtractorβ
βββββββββββ βββββββββββ
- Plugin system for external extractors
- Concurrent download support
- Post-processing hooks (thumbnail, subtitles)
- Metadata embedding (ID3, YUV)
- Queue management
MIT - See LICENSE file
- Fork the repository
- Create feature branch
- Add tests
- Submit pull request