| Crates.io | rust-yt-uploader |
| lib.rs | rust-yt-uploader |
| version | 0.2.8 |
| created_at | 2026-01-22 01:26:19.096245+00 |
| updated_at | 2026-01-22 04:57:50.178721+00 |
| description | High-performance YouTube video uploader in Rust with OAuth 2.0, concurrent uploads, and comprehensive validation |
| homepage | |
| repository | https://github.com/example-org/rust-yt-uploader |
| max_upload_size | |
| id | 2060546 |
| size | 176,834 |
A high-performance, memory-safe Rust library for YouTube video uploading with OAuth 2.0 authentication, featuring both programmatic API and command-line interface.
Add to your Cargo.toml:
[dependencies]
rust-yt-uploader = "0.2.8"
client_secret.json)client_secret.jsonThe first time you run the uploader, it will:
youtube-oauth2.jsongit clone https://github.com/leafyoung/rust-yt-uploader
cd rust-yt-uploader
cargo build --release --bin yt-upload
The binary will be available at target/release/rust-yt-upload.
use rust_yt_uploader::{YouTubeClient, ConfigFormat, BatchConfigRoot};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Load configuration
let config = BatchConfigRoot::from_file("config.yaml")?;
// Create authenticated client
let client = YouTubeClient::new(
"client_secret.json",
"youtube-oauth2.json"
).await?;
// Upload videos
client.upload_batch(&config).await?;
Ok(())
}
For more advanced use cases requiring direct API access:
use rust_yt_uploader::google_oauth::{GoogleOAuth, Credentials};
use rust_yt_uploader::youtube_client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create OAuth client with custom scopes
let oauth_client = GoogleOAuth::new(
"client_secret.json",
"youtube-oauth2.json",
youtube_client::default_youtube_scopes(),
youtube_client::build_youtube_base_url(),
).await?;
// Use the authenticated client for custom API calls
// The client handles token refresh automatically
let response = oauth_client
.http_client
.get("https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true")
.bearer_auth(&oauth_client.access_token)
.send()
.await?;
println!("API Response: {:?}", response.json::<serde_json::Value>().await?);
Ok(())
}
common:
prefix: "My Video Series"
keywords: "rust,youtube,programming"
category: ScienceTechnology
privacyStatus: "private"
playlistId: "PL1234567890123456"
titles:
- "Episode 1: Introduction"
- "Episode 2: Getting Started"
files:
- "/path/to/video1.mp4"
- "/path/to/video2.mp4"
videos:
- title: "My First Video"
description: "This is my first video"
keywords: "rust,youtube"
file: "/path/to/video1.mp4"
category: ScienceTechnology
privacyStatus: "private"
playlistId: "PL1234567890123456"
| ID | Category |
|---|---|
| 1 | Film & Animation |
| 2 | Autos & Vehicles |
| 10 | Music |
| 15 | Pets & Animals |
| 17 | Sports |
| 20 | Gaming |
| 22 | People & Blogs |
| 23 | Comedy |
| 24 | Entertainment |
| 25 | News & Politics |
| 26 | Howto & Style |
| 27 | Education |
| 28 | Science & Technology |
public: Video is visible to everyoneprivate: Video is only visible to youunlisted: Video is visible to anyone with the linkPlaylist IDs must match the pattern: ^PL[a-zA-Z0-9_-]{16,33}$
Example: PL1234567890123456
# Sequential upload (default)
cargo run --bin yt-upload --file config.yaml
# Sequential upload with progress bars
cargo run --bin yt-upload --file config.yaml --progress
# Concurrent upload (3 concurrent by default)
cargo run --bin yt-upload --file config.yaml --async
# Custom concurrency level
cargo run --bin yt-upload --file config.yaml --async --concurrent 5
tokio: Async runtime for high-performance I/Oreqwest: HTTP client for API callsserde/serde_yaml: Configuration parsing and serializationclap: Command-line argument parsingvalidator: Input validation with custom validatorstracing: Structured logginganyhow/thiserror: Comprehensive error handlingclient_secret.json or token files to version controlThis project is licensed under the MIT License - see the LICENSE file for details.