summaryrefslogtreecommitdiff
path: root/lib/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/videos.js')
-rw-r--r--lib/videos.js20
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') {