From dda170ac385953e3e067eab8062bfe3789e701e7 Mon Sep 17 00:00:00 2001 From: maxswa Date: Tue, 15 May 2018 17:51:33 -0400 Subject: [PATCH] getHiscores now returns rsns with spaces --- hiscores.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hiscores.js b/hiscores.js index 0b406a8..6447395 100644 --- a/hiscores.js +++ b/hiscores.js @@ -188,7 +188,7 @@ async function getHiscores (mode, category, page) { players.push({ category: category, 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), xp: attributes[3].innerHTML.slice(1, -1), mode: mode @@ -198,7 +198,7 @@ async function getHiscores (mode, category, page) { players.push({ category: category, 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), mode: mode }) @@ -291,4 +291,7 @@ let parseStats = (csv) => { return stats } +getHiscores('main', 'overall', 1) + .then(res => console.log(res)) + module.exports = {getStats, getHiscores} \ No newline at end of file