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").unwrap(); 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=AnRSXHQ2qyo").unwrap(); let title = content.title; let streams = content.streams; // It is necessary to pass the filename to generate in download() streams[0].download(&title); let audiostreams = content.audiostreams; audiostreams[0].download(&title); }
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 |
Enums
| Error |
The error type for rafy operations. |