updated readme

This commit is contained in:
Nils Pukropp committed 2021-07-18 18:09:37 +02:00
1 parent 9005a9c647
commit 5bbf2988a8
1 file changed
+7 -5
+7 -5
View File
@@ -4,11 +4,15 @@ This is a simple wrapper for [youtube-dl](https://youtube-dl.org/) in rust.
```rust ```rust
use ytd_rs::{YoutubeDL, ResultType, Arg}; use ytd_rs::{YoutubeDL, ResultType, 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 // 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 // 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 args = vec![Arg::new("--quiet"), Arg::new_with_arg("--output", "%(title).90s.%(ext)s")];
let link = "https://www.youtube.com/watch?v=uTO0KnDsVH0"; let link = "https://www.youtube.com/watch?v=uTO0KnDsVH0";
let ytd = YoutubeDL::new("./path/to/download/directory", args, link)?; let path = PathBuf::from("./path/to/download/directory");
let ytd = YoutubeDL::new(&path, args, link)?;
// start download // start download
let download = ytd.download(); let download = ytd.download();
@@ -19,8 +23,6 @@ match download.result_type() {
ResultType::IOERROR | ResultType::FAILURE => ResultType::IOERROR | ResultType::FAILURE =>
println!("Couldn't start download: {}", download.output()), println!("Couldn't start download: {}", download.output()),
}; };
Ok(())
}
``` ```