mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d4c7aaff2a | ||
![]() |
03c089ebff | ||
![]() |
96641d875a | ||
![]() |
b2bdd3d2ce | ||
![]() |
a4ddfaf199 | ||
![]() |
efbcdfc709 | ||
![]() |
fe913aba1f | ||
![]() |
1497653bab | ||
![]() |
f76de38eb1 | ||
![]() |
2f1d10b309 | ||
![]() |
f08424cb81 | ||
![]() |
69088db3b6 | ||
![]() |
9cc89735cd | ||
![]() |
a126ae4fc7 | ||
![]() |
52f3df1838 | ||
![]() |
2891bbddc4 | ||
![]() |
e2ea2fe33d | ||
![]() |
240628d9cc |
@@ -3,7 +3,7 @@
|
|||||||
[](https://www.npmjs.com/package/osrs-json-hiscores)
|
[](https://www.npmjs.com/package/osrs-json-hiscores)
|
||||||
[](https://npm-stat.com/charts.html?package=osrs-json-hiscores)
|
[](https://npm-stat.com/charts.html?package=osrs-json-hiscores)
|
||||||
[](https://github.com/maxswa/osrs-json-hiscores/blob/master/src/types.ts)
|
[](https://github.com/maxswa/osrs-json-hiscores/blob/master/src/types.ts)
|
||||||
[](https://github.com/maxswa/osrs-json-hiscores/actions/workflows/main.yml?query=branch%3Amain)
|
[](https://github.com/maxswa/osrs-json-hiscores/actions/workflows/main.yml?query=branch%3Amain)
|
||||||
|
|
||||||
**The Old School Runescape API wrapper that does more!**
|
**The Old School Runescape API wrapper that does more!**
|
||||||
|
|
||||||
@@ -154,6 +154,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
|
|||||||
| The Nightmare of Ashihama | `nightmare` |
|
| The Nightmare of Ashihama | `nightmare` |
|
||||||
| Phosani's Nightmare | `phosanisNightmare` |
|
| Phosani's Nightmare | `phosanisNightmare` |
|
||||||
| Obor | `obor` |
|
| Obor | `obor` |
|
||||||
|
| Phantom Muspah | `phantomMuspah` |
|
||||||
| Sarachnis | `sarachnis` |
|
| Sarachnis | `sarachnis` |
|
||||||
| Scorpia | `scorpia` |
|
| Scorpia | `scorpia` |
|
||||||
| Skotizo | `skotizo` |
|
| Skotizo | `skotizo` |
|
||||||
|
2322
__tests__/attackTopPage.html
vendored
2322
__tests__/attackTopPage.html
vendored
File diff suppressed because it is too large
Load Diff
2368
__tests__/b0atyNamePage.html
vendored
2368
__tests__/b0atyNamePage.html
vendored
File diff suppressed because it is too large
Load Diff
@@ -121,6 +121,7 @@ test('Parse CSV to json', () => {
|
|||||||
3,22666
|
3,22666
|
||||||
2,84
|
2,84
|
||||||
26,323
|
26,323
|
||||||
|
44,6233
|
||||||
201,1101
|
201,1101
|
||||||
82,3404
|
82,3404
|
||||||
5085,61
|
5085,61
|
||||||
@@ -218,6 +219,7 @@ test('Parse CSV to json', () => {
|
|||||||
nightmare: { rank: 3, score: 22666 },
|
nightmare: { rank: 3, score: 22666 },
|
||||||
phosanisNightmare: { rank: 2, score: 84 },
|
phosanisNightmare: { rank: 2, score: 84 },
|
||||||
obor: { rank: 26, score: 323 },
|
obor: { rank: 26, score: 323 },
|
||||||
|
phantomMuspah: { rank: 44, score: 6233 },
|
||||||
sarachnis: { rank: 201, score: 1101 },
|
sarachnis: { rank: 201, score: 1101 },
|
||||||
scorpia: { rank: 82, score: 3404 },
|
scorpia: { rank: 82, score: 3404 },
|
||||||
skotizo: { rank: 5085, score: 61 },
|
skotizo: { rank: 5085, score: 61 },
|
||||||
|
2323
__tests__/lynxTitanNamePage.html
vendored
2323
__tests__/lynxTitanNamePage.html
vendored
File diff suppressed because it is too large
Load Diff
@@ -85,4 +85,5 @@
|
|||||||
-1,-1
|
-1,-1
|
||||||
-1,-1
|
-1,-1
|
||||||
-1,-1
|
-1,-1
|
||||||
|
-1,-1
|
||||||
-1,-1
|
-1,-1
|
Can't render this file because it has a wrong number of fields in line 25.
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "osrs-json-hiscores",
|
"name": "osrs-json-hiscores",
|
||||||
"version": "2.10.1",
|
"version": "2.12.0",
|
||||||
"description": "The Old School Runescape API wrapper that does more!",
|
"description": "The Old School Runescape API wrapper that does more!",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
@@ -50,12 +50,11 @@ export async function getRSNFormat(rsn: string): Promise<string> {
|
|||||||
try {
|
try {
|
||||||
const response = await httpGet(url);
|
const response = await httpGet(url);
|
||||||
const dom = new JSDOM(response.data);
|
const dom = new JSDOM(response.data);
|
||||||
const spans = dom.window.document.querySelectorAll(
|
const anchor = dom.window.document.querySelector(
|
||||||
'span[style="color:#AA0022;"]'
|
'.personal-hiscores__row.personal-hiscores__row--type-highlight a'
|
||||||
);
|
);
|
||||||
if (spans.length >= 2) {
|
if (anchor) {
|
||||||
const nameSpan = spans[1];
|
return rsnFromElement(anchor);
|
||||||
return rsnFromElement(nameSpan);
|
|
||||||
}
|
}
|
||||||
throw Error('Player not found');
|
throw Error('Player not found');
|
||||||
} catch {
|
} catch {
|
||||||
@@ -75,7 +74,10 @@ export function parseStats(csv: string): Stats {
|
|||||||
.filter((entry) => !!entry)
|
.filter((entry) => !!entry)
|
||||||
.map((stat) => stat.split(','));
|
.map((stat) => stat.split(','));
|
||||||
|
|
||||||
if (splitCSV.length !== SKILLS.length + BH_MODES.length + CLUES.length + BOSSES.length + 5) {
|
if (
|
||||||
|
splitCSV.length !==
|
||||||
|
SKILLS.length + BH_MODES.length + CLUES.length + BOSSES.length + 5
|
||||||
|
) {
|
||||||
throw Error(INVALID_FORMAT_ERROR);
|
throw Error(INVALID_FORMAT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +107,12 @@ export function parseStats(csv: string): Stats {
|
|||||||
const [leaguePoints] = activityObjects.splice(0, 1);
|
const [leaguePoints] = activityObjects.splice(0, 1);
|
||||||
const bhObjects = activityObjects.splice(0, BH_MODES.length);
|
const bhObjects = activityObjects.splice(0, BH_MODES.length);
|
||||||
const clueObjects = activityObjects.splice(0, CLUES.length);
|
const clueObjects = activityObjects.splice(0, CLUES.length);
|
||||||
const [lastManStanding, pvpArena, soulWarsZeal, riftsClosed] = activityObjects.splice(0, 4);
|
const [
|
||||||
|
lastManStanding,
|
||||||
|
pvpArena,
|
||||||
|
soulWarsZeal,
|
||||||
|
riftsClosed
|
||||||
|
] = activityObjects.splice(0, 4);
|
||||||
const bossObjects = activityObjects.splice(0, BOSSES.length);
|
const bossObjects = activityObjects.splice(0, BOSSES.length);
|
||||||
|
|
||||||
const skills: Skills = skillObjects.reduce<Skills>((prev, curr, index) => {
|
const skills: Skills = skillObjects.reduce<Skills>((prev, curr, index) => {
|
||||||
|
@@ -5,7 +5,10 @@ export type Gamemode =
|
|||||||
| 'hardcore'
|
| 'hardcore'
|
||||||
| 'deadman'
|
| 'deadman'
|
||||||
| 'seasonal'
|
| 'seasonal'
|
||||||
| 'tournament';
|
| 'tournament'
|
||||||
|
| 'skiller'
|
||||||
|
| 'oneDefence'
|
||||||
|
| 'freshStart';
|
||||||
|
|
||||||
export interface Skill {
|
export interface Skill {
|
||||||
rank: number;
|
rank: number;
|
||||||
@@ -93,6 +96,7 @@ export type Boss =
|
|||||||
| 'nightmare'
|
| 'nightmare'
|
||||||
| 'phosanisNightmare'
|
| 'phosanisNightmare'
|
||||||
| 'obor'
|
| 'obor'
|
||||||
|
| 'phantomMuspah'
|
||||||
| 'sarachnis'
|
| 'sarachnis'
|
||||||
| 'scorpia'
|
| 'scorpia'
|
||||||
| 'skotizo'
|
| 'skotizo'
|
||||||
|
@@ -22,7 +22,10 @@ export const GAMEMODE_URL: GamemodeUrl = {
|
|||||||
ultimate: `${BASE_URL}_ultimate/`,
|
ultimate: `${BASE_URL}_ultimate/`,
|
||||||
deadman: `${BASE_URL}_deadman/`,
|
deadman: `${BASE_URL}_deadman/`,
|
||||||
seasonal: `${BASE_URL}_seasonal/`,
|
seasonal: `${BASE_URL}_seasonal/`,
|
||||||
tournament: `${BASE_URL}_tournament/`
|
tournament: `${BASE_URL}_tournament/`,
|
||||||
|
skiller: `${BASE_URL}_skiller/`,
|
||||||
|
oneDefence: `${BASE_URL}_skiller_defence/`,
|
||||||
|
freshStart: `${BASE_URL}_fresh_start/`
|
||||||
};
|
};
|
||||||
export const SKILLS: SkillName[] = [
|
export const SKILLS: SkillName[] = [
|
||||||
'overall',
|
'overall',
|
||||||
@@ -101,6 +104,7 @@ export const BOSSES: Boss[] = [
|
|||||||
'nightmare',
|
'nightmare',
|
||||||
'phosanisNightmare',
|
'phosanisNightmare',
|
||||||
'obor',
|
'obor',
|
||||||
|
'phantomMuspah',
|
||||||
'sarachnis',
|
'sarachnis',
|
||||||
'scorpia',
|
'scorpia',
|
||||||
'skotizo',
|
'skotizo',
|
||||||
@@ -175,6 +179,7 @@ export const FORMATTED_BOSS_NAMES: FormattedBossNames = {
|
|||||||
nightmare: 'The Nightmare of Ashihama',
|
nightmare: 'The Nightmare of Ashihama',
|
||||||
phosanisNightmare: "Phosani's Nightmare",
|
phosanisNightmare: "Phosani's Nightmare",
|
||||||
obor: 'Obor',
|
obor: 'Obor',
|
||||||
|
phantomMuspah: 'Phantom Muspah',
|
||||||
sarachnis: 'Sarachnis',
|
sarachnis: 'Sarachnis',
|
||||||
scorpia: 'Scorpia',
|
scorpia: 'Scorpia',
|
||||||
skotizo: 'Skotizo',
|
skotizo: 'Skotizo',
|
||||||
|
38
yarn.lock
38
yarn.lock
@@ -1186,9 +1186,9 @@ babel-preset-jest@^26.6.2:
|
|||||||
babel-preset-current-node-syntax "^1.0.0"
|
babel-preset-current-node-syntax "^1.0.0"
|
||||||
|
|
||||||
balanced-match@^1.0.0:
|
balanced-match@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||||
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
|
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
||||||
|
|
||||||
base@^0.11.1:
|
base@^0.11.1:
|
||||||
version "0.11.2"
|
version "0.11.2"
|
||||||
@@ -1576,7 +1576,7 @@ component-emitter@^1.2.1:
|
|||||||
concat-map@0.0.1:
|
concat-map@0.0.1:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
|
||||||
|
|
||||||
configstore@^5.0.1:
|
configstore@^5.0.1:
|
||||||
version "5.0.1"
|
version "5.0.1"
|
||||||
@@ -2804,9 +2804,9 @@ html-escaper@^2.0.0:
|
|||||||
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
|
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
|
||||||
|
|
||||||
http-cache-semantics@^4.0.0:
|
http-cache-semantics@^4.0.0:
|
||||||
version "4.1.0"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"
|
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
|
||||||
integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==
|
integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==
|
||||||
|
|
||||||
http-signature@~1.2.0:
|
http-signature@~1.2.0:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
@@ -3823,9 +3823,9 @@ json5@2.x, json5@^2.1.2:
|
|||||||
minimist "^1.2.5"
|
minimist "^1.2.5"
|
||||||
|
|
||||||
json5@^1.0.1:
|
json5@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
|
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
|
||||||
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
|
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
|
||||||
dependencies:
|
dependencies:
|
||||||
minimist "^1.2.0"
|
minimist "^1.2.0"
|
||||||
|
|
||||||
@@ -4279,9 +4279,9 @@ min-indent@^1.0.0:
|
|||||||
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
|
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
|
||||||
|
|
||||||
minimatch@^3.0.4:
|
minimatch@^3.0.4:
|
||||||
version "3.0.4"
|
version "3.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||||
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
|
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion "^1.1.7"
|
brace-expansion "^1.1.7"
|
||||||
|
|
||||||
@@ -4295,9 +4295,9 @@ minimist-options@^4.0.2:
|
|||||||
kind-of "^6.0.3"
|
kind-of "^6.0.3"
|
||||||
|
|
||||||
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5:
|
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5:
|
||||||
version "1.2.6"
|
version "1.2.7"
|
||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
|
||||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
|
||||||
|
|
||||||
mixin-deep@^1.2.0:
|
mixin-deep@^1.2.0:
|
||||||
version "1.3.2"
|
version "1.3.2"
|
||||||
@@ -4996,9 +4996,9 @@ pupa@^2.0.1:
|
|||||||
escape-goat "^2.0.0"
|
escape-goat "^2.0.0"
|
||||||
|
|
||||||
qs@~6.5.2:
|
qs@~6.5.2:
|
||||||
version "6.5.2"
|
version "6.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad"
|
||||||
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
|
integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==
|
||||||
|
|
||||||
queue-microtask@^1.2.2:
|
queue-microtask@^1.2.2:
|
||||||
version "1.2.3"
|
version "1.2.3"
|
||||||
|
Reference in New Issue
Block a user