0.1.0 • Published 7 years ago

youtube-dl-status v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

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

7 years ago

1.11.2

7 years ago