youtube-dl-status
v0.1.0
Published
Youtube-dl with status update from binary
Downloads
5
Readme
Youtube-dl-status
This code is a fork. It's not mine.
I have added one word. Just added return at lib/youtube-dl.js:161
. Looks like they are not accepting pull-requests anymore, so published it myself. This return statement makes it possible to get feedback of the download progress from the binary. In case you don't need this, don't use this library, use this one.
import YoutubeDL from 'youtube-dl-status';
const conf = [
'--extract-audio',
'--audio-quality=0',
'--format=bestaudio',
'--audio-format=mp3',
'--output=download.%(ext)s',
];
const downloadProcess = YoutubeDL.exec(url, conf, () => { console.log('Done!'); });
downloadProcess.stdout.on('data', (data) => {
const re = /[0-9]+((\.[0-9]{1}){0,1})%/i;
const matches = data.match(re);
if (matches && matches.length && matches.length > 0) {
// Prints the percentage.
console.log(matches[0]);
}
});