osrs-json-hiscores 2.10.1 → 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/hiscores.js +6 -6
  2. package/package.json +1 -1
package/lib/hiscores.js CHANGED
@@ -58,7 +58,7 @@ var utils_1 = require("./utils");
58
58
  */
59
59
  function getRSNFormat(rsn) {
60
60
  return __awaiter(this, void 0, void 0, function () {
61
- var url, response, dom, spans, nameSpan, _a;
61
+ var url, response, dom, anchor, _a;
62
62
  return __generator(this, function (_b) {
63
63
  switch (_b.label) {
64
64
  case 0:
@@ -79,10 +79,9 @@ function getRSNFormat(rsn) {
79
79
  case 2:
80
80
  response = _b.sent();
81
81
  dom = new jsdom_1.JSDOM(response.data);
82
- spans = dom.window.document.querySelectorAll('span[style="color:#AA0022;"]');
83
- if (spans.length >= 2) {
84
- nameSpan = spans[1];
85
- return [2 /*return*/, utils_1.rsnFromElement(nameSpan)];
82
+ anchor = dom.window.document.querySelector('.personal-hiscores__row.personal-hiscores__row--type-highlight a');
83
+ if (anchor) {
84
+ return [2 /*return*/, utils_1.rsnFromElement(anchor)];
86
85
  }
87
86
  throw Error('Player not found');
88
87
  case 3:
@@ -105,7 +104,8 @@ function parseStats(csv) {
105
104
  .split('\n')
106
105
  .filter(function (entry) { return !!entry; })
107
106
  .map(function (stat) { return stat.split(','); });
108
- if (splitCSV.length !== utils_1.SKILLS.length + utils_1.BH_MODES.length + utils_1.CLUES.length + utils_1.BOSSES.length + 5) {
107
+ if (splitCSV.length !==
108
+ utils_1.SKILLS.length + utils_1.BH_MODES.length + utils_1.CLUES.length + utils_1.BOSSES.length + 5) {
109
109
  throw Error(utils_1.INVALID_FORMAT_ERROR);
110
110
  }
111
111
  var skillObjects = splitCSV
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osrs-json-hiscores",
3
- "version": "2.10.1",
3
+ "version": "2.10.2",
4
4
  "description": "The Old School Runescape API wrapper that does more!",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",