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
};
});