mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Add getActivityPage
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { Gamemode, Category, SkillName } from '../types';
|
||||
import { Gamemode, SkillName, ActivityName } from '../types';
|
||||
import {
|
||||
BASE_URL,
|
||||
GAMEMODE_URL,
|
||||
STATS_URL,
|
||||
SCORES_URL,
|
||||
SKILLS,
|
||||
OTHER,
|
||||
ACTIVITIES,
|
||||
} from './constants';
|
||||
|
||||
export const getStatsURL = (gamemode: Gamemode, rsn: string) =>
|
||||
@@ -25,6 +25,17 @@ export const getSkillPageURL = (
|
||||
skill
|
||||
)}&page=${page}`;
|
||||
|
||||
export const getActivityPageURL = (
|
||||
gamemode: Gamemode,
|
||||
activity: ActivityName,
|
||||
page: number
|
||||
) =>
|
||||
`${BASE_URL}${
|
||||
GAMEMODE_URL[gamemode]
|
||||
}${SCORES_URL}category_type=1&table=${ACTIVITIES.indexOf(
|
||||
activity
|
||||
)}&page=${page}`;
|
||||
|
||||
export const numberFromElement = (el: CheerioElement) => {
|
||||
const innerText = el.firstChild.data;
|
||||
const number = innerText ? innerText.replace(/[\n|,]/g, '') : '-1';
|
||||
|
||||
Reference in New Issue
Block a user