youtube-dl-rs icon indicating copy to clipboard operation
youtube-dl-rs copied to clipboard

PermissionDenied error when unwarpping Result<YoutubeDlOutput, Error>

Open ChristopherVR opened this issue 1 year ago • 1 comments

I have to manually set a youtube dl path because it doesn't pick up the path setup in the System Environmental variables.

Here's the code I'm using

let search_options = SearchOptions::youtube(song).with_count(5);
let mut ytd = youtube_dl::YoutubeDl::search_for(&search_options);
let dl = youtube_dl::YoutubeDl::youtube_dl_path(&mut ytd, r"D:\youtube-dl-second");
let playlist = dl.run().unwrap().into_playlist().unwrap().entries.unwrap();

The error thrown:

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Os { code: 5, kind: PermissionDenied, message: "Access is denied." })'

I've tried running as administrator which did not yield any different results.

ChristopherVR avatar Mar 22 '23 10:03 ChristopherVR

The library defaults to using yt-dlp since version 0.8.0, as it seems to be better maintained than youtube-dl recently. If you want to use youtube-dl, you'll have to specify the path manually.

edit: That said, it looks like youtube-dl has seen a decent amount of activity again recently, so I might add back support, but I'd like to avoid doing it with compile-time flags.

GyrosOfWar avatar Mar 24 '23 08:03 GyrosOfWar