Crate rafy [−] [src]
rafy
is a simple-to-use library for downloading YouTube content and retrieving metadata.
About
rafy
takes the YouTube URL of the video and parses it. It returns fields like title,
author, likes/dislikes and other information about the video. It can also be used to download video
and audio streams with selectable quality.
Quick Example
You need to add the line below in [dependencies]
section in your Cargo.toml
rafy = "0.1"
The following example shows how simple it is to use rafy
to gather information about YouTube
videos.
extern crate rafy; use rafy::Rafy; fn main() { let content = Rafy::new("https://www.youtube.com/watch?v=4I_NYya-WWg"); println!("{}", content.videoid); println!("{}", content.title); println!("{}", content.author); println!("{}", content.likes); let streams = content.streams; for stream in streams { println!("{}", stream.extension); println!("{}", stream.url); } }
You can also download YouTube videos by calling method download()
on a Stream
struct.
extern crate rafy; use rafy::Rafy; fn main() { let content = Rafy::new("https://www.youtube.com/watch?v=qOOcy2-tmbk"); let streams = content.streams; streams[0].download(); }
License
rafy
is licensed under the MIT license. Please read the LICENSE file in
this repository for more information.
Structs
Rafy |
Once you have created a Rafy object using |
Stream |
After creating a |