#YouTube #metadata #content #downloader #rust


Rust library to download YouTube content and retrieve metadata

12 releases

0.2.1 Apr 2, 2018
0.2.0 Jul 23, 2017
0.1.9 Jul 14, 2017

#45 in Value formatting

Download history 2/week @ 2019-12-14 7/week @ 2019-12-21 14/week @ 2019-12-28 2/week @ 2020-01-04 28/week @ 2020-01-11 14/week @ 2020-01-18 7/week @ 2020-02-01 16/week @ 2020-02-08 7/week @ 2020-02-15 110/week @ 2020-02-22 5/week @ 2020-02-29 24/week @ 2020-03-07 13/week @ 2020-03-14 38/week @ 2020-03-21 15/week @ 2020-03-28

121 downloads per month
Used in yt_downloader

MIT license

234 lines


Rust Toolchain Crates.io Docs.rs Build Status

Rust library to fetch YouTube content and retrieve metadata. An attempt to mimic pafy but in Rust.


Put the below in your Cargo.toml


rafy = "0.2"

Usage Examples

extern crate rafy;
use rafy::Rafy;

fn main() {
    let content = Rafy::new("https://www.youtube.com/watch?v=DjMkfARvGE8").unwrap();
    println!("{}", content.videoid);
    println!("{}", content.title);
    println!("{}", content.rating);
    println!("{}", content.viewcount);

For more examples check out the Documentation.


  • This library won't be able to fetch audiostreams and videostreams for unpopular videos, because YouTube does not generate separate streams for unpopular videos. However, it will still be able to fetch normal streams.

  • Since this library does not depend on youtube-dl, there are some more things (not mentioning here) that we'll be missing out.

Running Tests

$ cargo test


  • Rust is still new to me. If there is anything that can be improved, please open an issue or even better, send a PR! 😄

  • Documentation improvements are also most welcome!


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


The MIT License


~152K SLoC