diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/videos.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/videos.js b/lib/videos.js index caf97d3..dbdf862 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -163,7 +163,7 @@ var handleList = function handleList(list, tags) { }); }, - getVideos = function getVideos(item, nocc) { + getVideos = function getVideos(item, nocc, notAvailable) { if (handout) { return getHandouts(item); } @@ -173,6 +173,7 @@ var handleList = function handleList(list, tags) { size = info.size; stash = info; if (co) { downloadList.push({id: item, name: path.basename(info._filename)}); } + if (notAvailable) { console.log('i'.magenta + ' No HQ video available for ' + info.fulltitle.white.bold + ' trying default quality ...'); } console.log('i'.magenta + ' Downloading: ' + info._filename.cyan + ' > ' + item); bar = new ProgressBar('>'.green + ' ' + filesize(size) + ' [:bar] :percent :etas', { complete: '=', incomplete: ' ', width: 20, total: parseInt(size, 10) }); console.time('i'.magenta + ' ' + info._filename + '. Done in'); @@ -184,6 +185,11 @@ var handleList = function handleList(list, tags) { }); dl.on('error', function error(err) { + if (err.message.indexOf('requested format not available') !== -1) { + _.pull(opt, '--format=22'); + opt.push('--format=18'); + return getVideos(item, nocc, true); + } console.log(err.stack); }); |