microlinkhq / youtube-dl-exec

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

Does not work if there is a space anywhere in the path #186

Closed mprobber closed 7 months ago

mprobber commented 7 months ago

Hi, I'm working on a personal project and wish to use this library. I am having issues because the path to the yt-dlp binary contains a space on my computer. Spawn reads everything after the first space to the binary as an argument.

There is also no error printed when this happens, so it was difficult to figure out what exactly was happening. I recommend that you change line 14 in index.js to simply

if (!stdout) return isJSON(stdout) ? JSON.parse(stdout) : stdout;

because stdout was returning undefined for me. This would have surfaced the error more easily.

Kikobeats commented 7 months ago

Hello, Are you using Linux or Windows? Are you passing a custom path? Can you provide a reproduction?

Kikobeats commented 7 months ago

Closing until a reproduciont or more information is provided

mprobber commented 7 months ago

Hi, I am running Ubuntu in WSL, so Linux, but also sort of Windows.

This repository reproduces the error https://github.com/mprobber/youtube-dl-exec-bug-repro/tree/master

mprobber commented 7 months ago

Please re-open :)

Kikobeats commented 7 months ago

Since I don't have Linux I can't reproduce this, but CI machines are Linux too and tests are green.

Can you try to debug what's happening here? https://github.com/microlinkhq/youtube-dl-exec/blob/master/src/index.js#L18