|
|
@ -1,7 +1,7 @@
|
|
|
|
const fs = require('fs');
|
|
|
|
const fs = require('fs');
|
|
|
|
const events = require('events');
|
|
|
|
const events = require('events');
|
|
|
|
const youtubedl = require('youtube-dl');
|
|
|
|
const youtubedl = require('youtube-dl');
|
|
|
|
|
|
|
|
// Download submitted video
|
|
|
|
module.exports = function (url, option, output) {
|
|
|
|
module.exports = function (url, option, output) {
|
|
|
|
let eventEmitter = new events.EventEmitter();
|
|
|
|
let eventEmitter = new events.EventEmitter();
|
|
|
|
|
|
|
|
|
|
|
@ -23,6 +23,7 @@ module.exports = function (url, option, output) {
|
|
|
|
video.on('end', function() {
|
|
|
|
video.on('end', function() {
|
|
|
|
eventEmitter.emit('end', output);
|
|
|
|
eventEmitter.emit('end', output);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return eventEmitter;
|
|
|
|
return eventEmitter;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|