getHiscores now returns rsns with spaces

This commit is contained in:
maxswa
2018-05-15 17:51:33 -04:00
parent 969f6e8d90
commit dda170ac38

View File

@@ -188,7 +188,7 @@ async function getHiscores (mode, category, page) {
players.push({ players.push({
category: category, category: category,
rank: attributes[0].innerHTML.slice(1, -1), rank: attributes[0].innerHTML.slice(1, -1),
rsn: attributes[1].childNodes[1].innerHTML, rsn: attributes[1].childNodes[1].innerHTML.replace(/\uFFFD/g, ' '),
level: attributes[2].innerHTML.slice(1, -1), level: attributes[2].innerHTML.slice(1, -1),
xp: attributes[3].innerHTML.slice(1, -1), xp: attributes[3].innerHTML.slice(1, -1),
mode: mode mode: mode
@@ -198,7 +198,7 @@ async function getHiscores (mode, category, page) {
players.push({ players.push({
category: category, category: category,
rank: attributes[0].innerHTML.slice(1, -1), rank: attributes[0].innerHTML.slice(1, -1),
rsn: attributes[1].childNodes[1].innerHTML, rsn: attributes[1].childNodes[1].innerHTML.replace(/\uFFFD/g, ' '),
score: attributes[2].innerHTML.slice(1, -1), score: attributes[2].innerHTML.slice(1, -1),
mode: mode mode: mode
}) })
@@ -291,4 +291,7 @@ let parseStats = (csv) => {
return stats return stats
} }
getHiscores('main', 'overall', 1)
.then(res => console.log(res))
module.exports = {getStats, getHiscores} module.exports = {getStats, getHiscores}