diff options
-rw-r--r-- | README.md | 29 | ||||
-rw-r--r-- | lib/videos.js | 16 | ||||
-rw-r--r-- | mongo-edu.js | 4 | ||||
-rw-r--r-- | package.json | 4 |
4 files changed, 38 insertions, 15 deletions
@@ -28,21 +28,26 @@ or see [detailed installation guide](https://github.com/przemyslawpluta/mongo-ed $ mongo-edu --help Options: - -d download path [required] - -u email address - --py pass switch to point to Python - --ncc no check certificate for py3.x < py3.4.x + -d download path [required] + -u email address + --py pass switch to point to Python + --ncc no check certificate for py3.x < py3.4.x + --proxy pass proxy switch Videos: - --cw switch from wiki video lists (default) to courseware - --cwd same as --cw and dumps list of videos to file in -d - --co sequence video files in order of the courseware - --cc get closed captions - --hq get high quality videos + --cw switch from wiki video lists (default) to courseware + --cwd same as --cw and dumps list of videos to file in -d + --co sequence video files in order of the courseware + --cc get closed captions + --hq get high quality videos Handouts: - -h switch from videos (default) to handouts - --uz unzip handout files + -h switch from videos (default) to handouts + --uz unzip handout files + +Debug: + --verbose print debug info + ``` ## Select and download @@ -51,7 +56,7 @@ Handouts: Download all available videos from lists present in the `wiki` pages for any given week. If no lists are present in `wiki` add `--cw` to search through the main courseware pages. -Add `--cc` to download closed captions with the videos and `--hq` to get high quality videos. Use with `--co` to sequence the video files in order of the wiki ( based on the order of the files present in the wiki lists ) or courseware ( when used with `--cw` preserves the courseware order ). +Add `--cc` to download closed captions with the videos and `--hq` to get high quality videos. Use with `--co` to sequence the video files in order of the wiki ( based on the order of the files present in the wiki lists ) or courseware ( when used with `--cw` preserves the courseware order ). Pass `--proxy` value to download videos through specified tunnled proxy. ![screenshot](https://raw.github.com/przemyslawpluta/mongo-edu/gh-pages/images/edu-videos.gif) diff --git a/lib/videos.js b/lib/videos.js index 17a9a41..f569407 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -19,19 +19,21 @@ var path = require('path'), mv = require('mv'), _ = require('lodash'); -var downloadPath = '', downloadList = [], co = false, ncc = false, handout = false, cc = false, uz = false, hq = false; +var downloadPath = '', proxy = '', downloadList = [], co = false, ncc = false, handout = false, cc = false, uz = false, hq = false, verbose = false; function setOptions(argv) { 'use strict'; downloadPath = argv.d; + proxy = argv.proxy; if (argv.ncc) { ncc = true; } if (argv.h) { handout = true; } if (argv.cc) { cc = true; } if (argv.uz) { uz = true; } if (argv.hq) { hq = true; } if (argv.co) { co = true; } + if (argv.verbose) { verbose = true; } } function rename(downloadPath, item, id, count, pass) { @@ -62,6 +64,10 @@ var handleList = function handleList(list, tags) { if (cc) { opt = opt.concat(['--write-sub', '--srt-lang=en']); } + if (verbose) { opt = opt.concat(['--verbose']); } + + if (proxy) { opt = opt.concat(['--proxy', proxy]); } + var getHandouts = function getHandouts(item) { var name = path.basename(item), bar, dounloadFile, dlh, left, extname, unzipFile, progressSoFar = -1, hold = 0, @@ -206,6 +212,10 @@ module.exports = { var bar = new ProgressBar('>'.magenta + ' Collecting [:bar] :percent', { complete: '=', incomplete: ' ', width: 20, total: opt.length }), options = (!ncc) ? [] : ['--no-check-certificate']; + if (verbose) { options = options.concat(['--verbose']); } + + if (proxy) { options = options.concat(['--proxy', proxy]); } + var isFinished = function isFinished(count, items) { if (count === 0) { @@ -291,6 +301,10 @@ module.exports = { var options = (!ncc) ? [] : ['--no-check-certificate'], items = [], i, item; + if (verbose) { options = options.concat(['--verbose']); } + + if (proxy) { options = options.concat(['--proxy', proxy]); } + youtubedl.getInfo(opt.url, options, function(err, info) { if (info.length) { diff --git a/mongo-edu.js b/mongo-edu.js index 7a7dc6d..5438dc1 100644 --- a/mongo-edu.js +++ b/mongo-edu.js @@ -18,6 +18,7 @@ var mdbvideos = require('./lib/login'), .describe('d', 'download path').describe('u', 'email address') .describe('h', 'switch from videos (default) to handouts').boolean('h') .describe('py', 'py switch').describe('py', 'switch to point to Python') + .describe('proxy', 'pass proxy').describe('proxy', 'proxy address') .describe('cw', 'switch from wiki\'s video lists (default) to courseware').boolean('cw') .describe('cwd', 'same as --cw and dumps list of videos to file in -d').boolean('cwd') .describe('cc', 'get closed captions').boolean('cc') @@ -25,6 +26,7 @@ var mdbvideos = require('./lib/login'), .describe('ncc', 'no check certificate').boolean('ncc') .describe('uz', 'unzip handout files').boolean('uz') .describe('co', 'sequence video files in order of the courseware').boolean('co') + .describe('verbose', 'print debug information').boolean('verbose') .demand('d'); exports.create = function start() { @@ -39,6 +41,8 @@ exports.create = function start() { if (argv.d.substr(-1) !== slash) { argv.d += slash; } + if (argv.proxy) { console.log('i'.magenta + ' Proxy Video Download: '.bold + argv.proxy.green); } + validate.init(argv, function init(err, profile) { if (err !== null) { throw err; } diff --git a/package.json b/package.json index 3a6a505..44c5f69 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mongo-edu", "preferGlobal": true, - "version": "0.1.36", + "version": "0.1.37", "author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)", "description": "Select and download videos and handouts from university.mongodb.com courses", "main": "./mongo-edu", @@ -34,7 +34,7 @@ "colors": "~0.6.2", "filesize": "~2.0.3", "glob": "~4.0.6", - "inquirer": "~0.7.3", + "inquirer": "~0.8.0", "lodash": "~2.4.1", "mkdirp": "~0.5.0", "mv": "~2.0.3", |