diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/videos.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/videos.js b/lib/videos.js index 33df751..9c90f92 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -18,7 +18,8 @@ var path = require('path'), rimraf = require('rimraf'), mv = require('mv'), _ = require('lodash'), - moment = require('moment'); + moment = require('moment'), + getYouTubeID = require('get-youtube-id'); var isDebug = /[debug]/, downloadPath = '', proxy = '', downloadList = [], hash = {}, co = false, ncc = false, handout = false, cc = false, uz = false, hq = false, verbose = false, retry = 10, maxRetry; @@ -287,11 +288,11 @@ module.exports = { youtubedl.getInfo(item, options, function(err, info) { - if (verbose && isDebug.test(err)) { console.log(err); } + if (verbose && isDebug.test(err)) { console.log('i'.red + ' Get Info Failed: '.red + err.stack); } - hash[item] = info._filename; + hash[item] = (!err && info) ? info._filename : getYouTubeID(item); - items.push((!err)?{name: info.fulltitle + ' - ' + info.width + 'x' + info.height, value: item, id: i}:{name: 'No info: ' + item, value: item, id: i}); + items.push((!err && info)?{name: info.fulltitle + ' - ' + info.width + 'x' + info.height, value: item, id: i}:{name: 'No info: ' + item, value: item, id: i}); count = count - 1; |