Youtube searching and downloading module written with pure Rust. Download videos blazing-fast without getting stuck on Youtube download speed (Downloads 20MB video files in just 10 seconds!)
```rust,ignore use rusty_ytdl::Video;
async fn main() { let video_url = "https://www.youtube.com/watch?v=FZ8BxMU3BYc"; // FZ8BxMU3BYc works too! let video = Video::new(url).unwrap();
let videodownloadbuffer = video.download().await;
// Do what you want with video buffer vector println!("{:#?}",video_buffer);
// Or with options
let video_options = VideoOptions { quality: VideoQuality::Lowest, filter: VideoSearchOptions::Audio, ..Default::default() };
let video = Video::newwithoptions(url, videooptions).unwrap(); let videodownload_buffer = video.download().await;
// Do what you want with video buffer vector println!("{:#?}",video_buffer); } ```
or get only video informations
```rust,ignore use rustyytdl::Video; use rustyytdl::{choose_format,VideoOptions};
async fn main() { let video_url = "https://www.youtube.com/watch?v=FZ8BxMU3BYc"; // FZ8BxMU3BYc works too! // Also works with live videos!! let video = Video::new(url).unwrap();
let videoinfo = video.getinfo().await.unwrap(); println!("{:#?}",video_info);
/*
VideoInfo {
dashmanifesturl: Option
let video_options = VideoOptions { quality: VideoQuality::Lowest, filter: VideoSearchOptions::Audio, ..Default::default() };
let format = chooseformat(&videoinfo.unwrap().formats,&video_options);
println!("{:#?}",format);
// Or with options let video = Video::newwithoptions(url, video_options.clone()).unwrap();
let format = chooseformat(&videoinfo.formats, &video_options);
let videoinfo = video.getinfo().await.unwrap();
println!("{:#?}",video_info); } ```
For more examples, check examples
rusty_ytdl cannot download videos that fall into the following
Generated download links are valid for 6 hours, and may only be downloadable from the same IP address.
When doing to many requests YouTube might block. This will result in your requests getting denied with HTTP Status Code 429. The following steps might help you:
bash
cargo add rusty_ytdl
Or add the following to your Cargo.toml
file:
toml
[dependencies]
rusty_ytdl = "0.5.0"