Struct rafy::Stream [] [src]

pub struct Stream {
    pub extension: String,
    pub quality: String,
    pub url: String,
}

After creating a Stream struct, you can check its attributes or call methods on it.

Examples

extern crate rafy;
use rafy::Rafy;

fn main() {
    let content = Rafy::new("https://www.youtube.com/watch?v=DjMkfARvGE8").unwrap();
    for stream in content.streams {
        println!("{}", stream.extension);
        println!("{}", stream.url);
    }
}

Fields

The extension of the stream

The quality of the stream

The url of the stream

Methods

impl Stream
[src]

Create a Vec<Stream> object by calling Rafy::new().streams .

Examples

extern crate rafy;
use rafy::Rafy;

fn main() {
    let content = Rafy::new("https://www.youtube.com/watch?v=DjMkfARvGE8").unwrap();
    let streams = content.streams;
    let ref stream = streams[0];
}

[src]

Downloads the content stream from Stream object.

Examples

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;
    let ref stream = streams[0];
    // It is necessary to pass the filename to generate in download()
    stream.download(&title);

    let audiostreams = content.audiostreams;
    let ref audiostream = audiostreams[0];
    audiostream.download(&title);

    let videostreams = content.videostreams;
    let ref videostream = videostreams[0];
    videostream.download(&title);
}

Trait Implementations

impl Debug for Stream
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Stream
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Stream

impl Sync for Stream