diff options
Diffstat (limited to 'lib/login.js')
-rw-r--r-- | lib/login.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/login.js b/lib/login.js index d1b2d8c..7223126 100644 --- a/lib/login.js +++ b/lib/login.js @@ -110,12 +110,16 @@ module.exports = { $('div.wiki-article p').children().filter('a').map(function map(i, item) { var current = $(item); - if (current.text().indexOf(options) !== -1) { list.push(current.attr('href')); } + if (current.text().indexOf(options) !== -1) { + list.push({ href: current.attr('href'), text: current.text() }); + } }); - getCourses = _.filter(list, function map(item) { return item.match(/(wiki\/M101|wiki\/M102|wiki\/C100|wiki\/M202)/); }); + getCourses = _.filter(list, function map(item) { + if (item.href.match(/(wiki\/M101|wiki\/M102|wiki\/C100|wiki\/M202|wiki\/list-youtube-links)/)) { return item; } + }); - callback(null, _.map(getCourses, function map(item) { return { name: item.replace(tag, '').slice(0, -1).slice(1).replace(/-/g, ' ').replace(/\//g, ': '), value: item }; })); + callback(null, _.map(getCourses, function map(item) { return { name: !item.href.match(/wiki\/list-youtube-links/) ? item.href.replace(tag, '').slice(0, -1).slice(1).replace(/-/g, ' ').replace(/\//g, ': ') : item.text, value: item.href }; })); } }); |