yt_info

Rust Toolchain Crates.io Docs.rs

Rust library to fetch YouTube content and retrieve metadata. Fork of rafy-rs

Installation

Put the below in your Cargo.toml

[dependencies]

yt_info = "0.3.1"

Usage Examples

```rust use yt_info::VideoInfo; use std::fs::File; use std::io;

fn main() { let youtubetoken = env!("YOUTUBETOKEN");

let video = VideoInfo::new(youtube_token,"https://www.youtube.com/watch?v=C0DPdy98e4c").unwrap();
let streams = video.streams;
let stream = &streams[0];

let filename = format!("{}-stream.{}",&video.title,&stream.extension);

let mut file = File::create(filename).unwrap();
let mut stream_reader = stream.get_reader().unwrap();

io::copy(&mut stream_reader,&mut file).unwrap();

} ```

For more examples check out the Documentation.

Limitations

Running Tests

$ cargo test

Contributing

All pull requests all welcome

Thanks

The basic method of extracting streams was stolen from rust-youtube-downloader by smoqadam.

License

The MIT License