diff options
-rw-r--r-- | lib/courseware.js | 8 | ||||
-rw-r--r-- | package.json | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/courseware.js b/lib/courseware.js index 7d7ca7c..7ed606a 100644 --- a/lib/courseware.js +++ b/lib/courseware.js @@ -47,9 +47,13 @@ function listVideos(url, jar, id, callback) { var $ = cheerio.load(body), pageView = $('div.col-sm-9.course-content section').html(), - getVideoIds = (pageView) ? pageView.match(/(.0:)(.*?)(&)/g) : pageView; + getVideoIds = (pageView) ? pageView.match(/(.0:)(.*?)(&)/g) : pageView, i; - if (getVideoIds && getVideoIds.length > 1) { getVideoIds = [getVideoIds[0]]; } + if (getVideoIds && getVideoIds.length > 1) { + for (i = 0; i < getVideoIds.length; i++) { + if (getVideoIds[i].length > 15) { getVideoIds.splice(i, 1); } + } + } getVideoIds = (!getVideoIds) ? [] : getVideoIds.map(function map(item) { return { id: id, video: 'https://youtu.be/' + item.replace('.0:','').replace('&','')}; }); diff --git a/package.json b/package.json index b2d7a10..0751bda 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mongo-edu", "preferGlobal": true, - "version": "0.2.7", + "version": "0.2.8", "author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)", "description": "Select and download videos and handouts from university.mongodb.com courses", "main": "./mongo-edu", |