mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Replace cheerio with jsdom.
This commit is contained in:
@@ -35,13 +35,13 @@ export const getActivityPageURL = (
|
||||
activity
|
||||
)}&page=${page}`;
|
||||
|
||||
export const numberFromElement = (el: CheerioElement) => {
|
||||
const innerText = el.firstChild.data;
|
||||
const number = innerText ? innerText.replace(/[\n|,]/g, '') : '-1';
|
||||
export const numberFromElement = (el: Element | null) => {
|
||||
const { innerHTML } = el || {};
|
||||
const number = innerHTML?.replace(/[\n|,]/g, '') ?? '-1';
|
||||
return parseInt(number, 10);
|
||||
};
|
||||
|
||||
export const rsnFromElement = (el: CheerioElement | undefined) => {
|
||||
const innerText = el?.firstChild.data;
|
||||
return innerText ? innerText.replace(/\uFFFD/g, ' ') : '';
|
||||
export const rsnFromElement = (el: Element | null) => {
|
||||
const { innerHTML } = el || {};
|
||||
return innerHTML?.replace(/\uFFFD/g, ' ') || '';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user