Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

youtube-dl showing Error: Command failed with exit code 1

I have created node js function for download youtube videos. when I run the function following error is showing: youtube-dl showing Error: Command failed with exit code 1: \node_modules\youtube-dl\bin\youtube-dl.exe --dump-json --format=18 --encoding utf8 http://www.youtube.com/watch?v=4FDud9Lj5HY

const video = youtubedl(
    url,
    // Optional arguments passed to youtube-dl.
    ['--format=18'],
    // Additional options can be given for calling `child_process.execFile()`.
    { cwd: __dirname }
);

video.on('info', function (info) {
    const _data = {
        thumbnail: info.thumbnails[info.thumbnails.length - 1].url,
        size: info.size / 1024 / 1024
    };

});
like image 836
javed Avatar asked Oct 30 '25 17:10

javed


1 Answers

I found a solution. I uninstall "youtube-dl" and reinstalled it. This issue is related to a plugin update Update

Since the youtube-dl binary is updated regularly, you can run npm run update to check for and download any updates for it. You can also require youtube-dl/lib/downloader in your app if you'd like to place youtube-dl binary in a specific directory and control when it gets updates.

like image 80
javed Avatar answered Nov 01 '25 07:11

javed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!