microlinkhq / youtube-dl-exec

A simple Node.js wrapper for youtube-dl/yt-dlp.
MIT License
423 stars 75 forks source link

All downloads return 'undefined' #188

Closed notmutiny closed 4 months ago

notmutiny commented 7 months ago

My Node.js script was working fine earlier today. Without making any changes, all requests made to this package are returning undefined for the response (not catching) including requests which were previously successful. What is happening? And how do I diagnose this package to identify that?

notmutiny commented 7 months ago

Possibly related (I don't know because youtube-dl-exec is not returning any errors) https://github.com/yt-dlp/yt-dlp/issues/9399

Kikobeats commented 7 months ago

It's more related with yt-dlp codebase than this library as wrapper 👍

timothyhilton commented 6 months ago

I have the same issue. No idea what is causing it, yt-dlp works fine. This entire package seems broken.

mfkrause commented 4 months ago

For anyone stumbling upon this issue: In my case (yt-dlp working fine on the commandline, but this package returning undefined on every call) the problem was "caused" by this script / default behavior of the library:

https://github.com/microlinkhq/youtube-dl-exec/blob/a97acec55287cd44d090ea05eafcc7323ff87f2f/scripts/postinstall.js#L31-L41

The library downloads the latest yt-dlp release during its postinstall script. After I moved some files around on my OS, the downloaded binary went missing, causing the library to be unable to spawn it. I diagnosed this by using ytDownload.exec(), which returns the raw subprocess, instead of ytDownload().

In this case, either re-install the library or use create('/path/to/yt-dlp') to hard-code the path to a yt-dlp binary on your system.

Anyhow, the library shouldn't simply return undefined when this happens but rather throw an error (cc @Kikobeats).

Kikobeats commented 4 months ago

@mfkrause that's a good catch, can you make a PR? 🙏

mfkrause commented 4 months ago

@mfkrause that's a good catch, can you make a PR? 🙏

I'll see if I can find some time to spin up a PR next week, I'd have to look deeper into how you spawn the process :)

Kikobeats commented 4 months ago

Hello, it should be fixed https://github.com/microlinkhq/youtube-dl-exec/pull/200

Can you test the last version? 🙂