diff options
author | przemyslawpluta <przemekpluta@hotmail.com> | 2014-02-17 18:43:58 +0000 |
---|---|---|
committer | przemyslawpluta <przemekpluta@hotmail.com> | 2014-02-17 18:43:58 +0000 |
commit | c9c95c52d4265f0bd8925946f43668a2d07cc41d (patch) | |
tree | 9fefa65f46bf19c5833c403f5afc42d810b5c15d /lib/videos.js | |
parent | 053ff35e80cdcc4c2572a8892ead25e5f1f02bf1 (diff) | |
download | mongo-edu-c9c95c52d4265f0bd8925946f43668a2d07cc41d.zip |
py3.x opt added
Diffstat (limited to 'lib/videos.js')
-rw-r--r-- | lib/videos.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/videos.js b/lib/videos.js index 44bfd7e..5eb21d2 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -11,15 +11,16 @@ var youtubedl = require('youtube-dl'), colors = require('colors'), _ = require('lodash'); -var downloadPath = ''; +var downloadPath = '', ncc = false; var handleList = function handleList(list) { var currentList = list, + opt = (!ncc) ? ['--max-quality=18'] : ['--max-quality=18', '--no-check-certificate']; getVideos = function getVideos(item) { - var dl = youtubedl.download(item, downloadPath, ['--max-quality=18']), bar; + var dl = youtubedl.download(item, downloadPath, opt), bar; dl.on('download', function(data) { console.log('[' + 'i'.magenta + '] Downloading: ' + data.filename.cyan + ' > ' + item); @@ -57,14 +58,19 @@ var handleList = function handleList(list) { module.exports = { - details: function details(opt, callback) { + details: function details(opt, argv, callback) { - var bar = new ProgressBar('[' + '>'.magenta + '] Collecting [:bar] :percent', { complete: '=', incomplete: ' ', width: 20, total: opt.length }); + downloadPath = argv.d; + if (argv.ncc) { ncc = true; } + + var bar = new ProgressBar('[' + '>'.magenta + '] Collecting [:bar] :percent', { complete: '=', incomplete: ' ', width: 20, total: opt.length }), + options = (!ncc) ? [] : ['--no-check-certificate']; var getDetails = function getDetails(item, i) { function getInfo() { - youtubedl.getInfo(item, function(err, info) { + + youtubedl.getInfo(item, options, function(err, info) { items.push((!err)?{name: info.title + ' - ' + info.resolution, value: item, id: i}:{name: 'No info: ' + item, value: item, id: i}); @@ -97,12 +103,10 @@ module.exports = { } }, - download: function download(opt, list, argv) { + download: function download(opt, list) { var options = opt.videos, fullList = [], selected = []; - downloadPath = argv.d; - if (options.length === 1 && options[0] === 'cancel') { return console.log('Cancel'); } if (options.length === 1 && options[0] === 'all') { |