GyrosOfWar / youtube-dl-rs

A youtube-dl wrapper for Rust
132 stars 40 forks source link

No such file or directory #59

Open woheme-c opened 8 months ago

woheme-c commented 8 months ago

When I follow the instructions for the base code like as in the documentary shown, I'll get weired behaviours.

(short) overview:

use youtube_dl::YoutubeDl;

let output = YoutubeDl::new("https://www.youtube.com/watch?v=12356789").run().unwrap(); let title = output.into_single_video().unwrap().title; println!("Video title: {title:?}");

Result:

thread 'main' panicked at src/main.rs:87:86: called Result::unwrap() on an Err value: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

With Backtrace:

stack backtrace: 0: rust_begin_unwind at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5 1: core::panicking::panic_fmt at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14 2: core::result::unwrap_failed at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1652:5 3: core::result::Result<T,E>::unwrap at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1077:23 4: youtube_transcriptor::process_link at ./src/main.rs:88:18 5: youtube_transcriptor::main at ./src/main.rs:150:13 6: core::ops::function::FnOnce::call_once at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

Also, there is no preview when I call up the methods. (I use the rust-analyzer).

Maybe somebody can help.

ps. I am relatively new to rust.

rksm commented 8 months ago

This seems like there is no yt-dlp in your $PATH. You can either have youtube-dl-rs download it, see https://github.com/GyrosOfWar/youtube-dl-rs/blob/master/examples/downloader.rs or install it with other means. By default youtube-dl-rs will try to find the yt-dlp binary, you can use the setter to modify that.