summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md11
-rw-r--r--lib/videos.js20
-rw-r--r--mongo-edu.js7
-rw-r--r--package.json2
4 files changed, 24 insertions, 16 deletions
diff --git a/README.md b/README.md
index a4f1c7c..a223023 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
mongo-edu
=========
+[![NPM](https://nodei.co/npm/mongo-edu.png?mini=true)](https://nodei.co/npm/mongo-edu/)
+
[![NPM version](https://badge.fury.io/js/mongo-edu.png)](http://badge.fury.io/js/mongo-edu)
[![Dependency Status](https://gemnasium.com/przemyslawpluta/mongo-edu.png)](https://gemnasium.com/przemyslawpluta/mongo-edu)
@@ -11,17 +13,18 @@ Select and download video courses from [education.mongodb.com](https://education
##Installation
```js
-npm install -g mongo-edu
+npm install mongo-edu -g
```
##Usage
```js
-mongo-edu -u [user name] -d [download path]
+mongo-edu -u [user name] -d [download path] --ncc [no check certificate]
Options:
- -d download path [required]
- -u email address
+ -d download path [required]
+ -u email address
+ --ncc no check certificate py3.x
```
##License
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') {
diff --git a/mongo-edu.js b/mongo-edu.js
index 71652f0..6a5d1e1 100644
--- a/mongo-edu.js
+++ b/mongo-edu.js
@@ -12,8 +12,9 @@ var mdbvideos = require('./lib/login'),
colors = require('colors'),
inquirer = require('inquirer'),
argv = require('optimist')
- .usage('Usage: $0 -u [user name] -d [download path]')
+ .usage('Usage: $0 -u [user name] -d [download path] --ncc [no check certificate]')
.describe('d', 'download path').describe('u', 'email address')
+ .describe('ncc', 'no check certificate with py3.x').boolean('ncc')
.demand('d').argv;
exports.create = function start() {
@@ -74,7 +75,7 @@ exports.create = function start() {
mdbvideos.listVideos(answers, function get(err, data, pass) {
if (err !== null) { throw err; }
- if (!pass) { return videoHandler.details(data, showDetails); }
+ if (!pass) { return videoHandler.details(data, argv, showDetails); }
showDetails(err, data);
});
@@ -88,7 +89,7 @@ exports.create = function start() {
check[0].choices = data;
return inquirer.prompt(check, function prompt(answers) {
- videoHandler.download(answers, data, argv);
+ videoHandler.download(answers, data);
});
}
diff --git a/package.json b/package.json
index b41de57..65469b6 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "mongo-edu",
"preferGlobal": true,
- "version": "0.1.1",
+ "version": "0.1.2",
"author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)",
"description": "Select and download video courses from education.mongodb.com",
"main": "./mongo-edu",