#youtube-dl #arg #output #download #output-format #run #ytd

ytd-rs

A simple wrapper for youtube-dl. Youtube-dl has to be installed on the system

8 releases

0.1.7 Apr 5, 2022
0.1.6 Nov 14, 2021
0.1.5 Oct 23, 2021
0.1.4 Jul 18, 2021
0.1.2 May 12, 2021

#205 in Multimedia

Download history 45/week @ 2023-12-18 42/week @ 2023-12-25 68/week @ 2024-01-01 62/week @ 2024-01-08 128/week @ 2024-01-15 86/week @ 2024-01-22 72/week @ 2024-01-29 59/week @ 2024-02-05 86/week @ 2024-02-12 71/week @ 2024-02-19 94/week @ 2024-02-26 80/week @ 2024-03-04 100/week @ 2024-03-11 174/week @ 2024-03-18 158/week @ 2024-03-25 222/week @ 2024-04-01

671 downloads per month
Used in 5 crates (3 directly)

Custom license

10KB
151 lines

ytd-rs

Build status crates.io docs.rs dependency status

This is a simple wrapper for youtube-dl in rust.

use ytd_rs::{YoutubeDL, Arg};
use std::path::PathBuf;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
    // youtube-dl arguments quietly run process and to format the output
    // one doesn't take any input and is an option, the other takes the desired output format as input
    let args = vec![Arg::new("--quiet"), Arg::new_with_arg("--output", "%(title).90s.%(ext)s")];
    let link = "https://www.youtube.com/watch?v=uTO0KnDsVH0";
    let path = PathBuf::from("./path/to/download/directory");
    let ytd = YoutubeDL::new(&path, args, link)?;

    // start download
    let download = ytd.download()?;

    // print out the download path
    println!("Your download: {}", download.output_dir().to_string_lossy())
    Ok(())
}

Dependencies

~2.4–4MB
~71K SLoC