diff options
author | Noah Loomans <noahloomans@gmail.com> | 2016-10-06 12:09:31 +0200 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2016-10-06 12:09:31 +0200 |
commit | 0dadad90af890a877b0ea66b9385d7e968a53268 (patch) | |
tree | eb62e3fe8d549e08e1c0e8fb64c093781c9d9423 /lib | |
parent | fd3430bbca1526d4502c3377c2e762d9b6b264b2 (diff) |
remove aliases
Diffstat (limited to 'lib')
-rw-r--r-- | lib/getUserIndex.js | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/lib/getUserIndex.js b/lib/getUserIndex.js index 07b914a..d71cb3b 100644 --- a/lib/getUserIndex.js +++ b/lib/getUserIndex.js @@ -3,8 +3,6 @@ const Promise = require('bluebird') const cheerio = require('cheerio') const request = Promise.promisify(require('request')) -const getURLOfUsers = require('../lib/getURLOfUsers') -const encoding = require('encoding') exports = {} module.exports = exports @@ -31,74 +29,34 @@ function getStandardUsers () { return { type: 'c', value: item, - index: index, - other: '', - isID: true + index: index } })) .concat(items[1].map(function (item, index) { return { type: 't', value: item, - index: index, - other: '', - isID: true + index: index } })) .concat(items[2].map(function (item, index) { return { type: 'r', value: item, - index: index, - other: '', - isID: true + index: index } })) .concat(items[3].map(function (item, index) { return { type: 's', value: item, - index: index, - other: '', - isID: true + index: index } }))) }) }) } -function addExtendedUsers (standardUsers) { - const standardUsersLength = standardUsers.length - for (let i = 0; i < standardUsersLength; i++) { - // for (let i = 200; i < 220; i++) { - request(getURLOfUsers(0, standardUsers[i].type, standardUsers[i].index + 1)) - .then(page => page.body) - .then(page => encoding.convert(page, 'UTF-8', 'Windows-1252')) - .then(function (page) { - const $ = cheerio.load(page) - let extendedName = $('font').eq(2).text().trim() - - if (standardUsers[i].type === 's' || standardUsers[i].type === 't') { - extendedName = extendedName.split(/\s+/).reverse().join(' ') - } - - if (extendedName.indexOf(standardUsers[i].value) === -1 && - extendedName.indexOf(standardUsers[i].value.substring(2, standardUsers[i].value.length))) { - console.log(`added ${extendedName}: ${standardUsers[i].value}`) - standardUsers[i].other = extendedName - standardUsers.push({ - type: standardUsers[i].type, - index: standardUsers[i].index, - value: extendedName, - other: standardUsers[i].value, - isID: false - }) - } - }) - } -} - getStandardUsers().then(users => { - addExtendedUsers(users) exports.users = users }) |