Crates.io | ccobalt |
lib.rs | ccobalt |
version | 0.2.1 |
created_at | 2025-06-08 10:50:58.209764+00 |
updated_at | 2025-07-17 14:06:15.427376+00 |
description | A Rust library to download media using the Cobalt API. |
homepage | https://github.com/CleeSim/ccobalt |
repository | https://github.com/CleeSim/ccobalt.git |
max_upload_size | |
id | 1704772 |
size | 69,676 |
CCobalt allows you to easily interact with the Cobalt API.
use ccobalt::{
Client,
model::request::{DownloadRequest, VideoQuality},
};
#[tokio::main]
async fn main() {
let client = Client::builder()
.base_url("https://api.example.com/")
.api_key("YOUR_API_KEY")
.build()
.expect("Failed to build client");
let request = DownloadRequest {
url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ".to_string(),
video_quality: Some(VideoQuality::Q4320),
..Default::default()
};
match client.download_and_save(&request, "download", ".").await {
Ok(path) => {
println!("File saved to: {:?}", path);
}
Err(err) => {
eprintln!("Download failed: {}", err);
}
}
}