aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorRitesh Ghosh <[email protected]>2023-08-03 23:26:16 +0530
committerRitesh Ghosh <[email protected]>2023-08-03 23:26:16 +0530
commit8f1eabe2d9162ade3adcd604417f4f2b8ce95265 (patch)
tree8fc228d4a368dc0447a3adcfe6aacb195ea202ce /src/utils
parent4a1a9249b9aee0cc3446c9a1532eb74786220115 (diff)
downloadaniwatch-api-8f1eabe2d9162ade3adcd604417f4f2b8ce95265.tar.xz
aniwatch-api-8f1eabe2d9162ade3adcd604417f4f2b8ce95265.zip
fix(otherInfoBug): `otherInfo` wouldn't show all stats
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/index.ts30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/utils/index.ts b/src/utils/index.ts
index e960dd9..f92870b 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -143,18 +143,6 @@ export function extractMostPopularAnimes(
const animes: Array<MostPopularAnime> = [];
$(selector).each((i, el) => {
- const otherInfoSrc = $(el)
- ?.find(".fd-infor .tick")
- ?.text()
- ?.trim()
- ?.replace(/\n/g, "")
- .split(" ");
-
- let otherInfos: string[] = [
- otherInfoSrc[0] || "",
- otherInfoSrc?.pop() || "",
- ];
-
animes.push({
id:
$(el)
@@ -173,7 +161,23 @@ export function extractMostPopularAnimes(
.find(".film-detail .film-name .dynamic-name")
.attr("data-jname")
?.trim() || null,
- otherInfo: otherInfos.filter((i) => i !== ""),
+
+ episodes: {
+ sub:
+ Number($(el)?.find(".fd-infor .tick .tick-sub")?.text()?.trim()) ||
+ null,
+ dub:
+ Number($(el)?.find(".fd-infor .tick .tick-dub")?.text()?.trim()) ||
+ null,
+ },
+ type:
+ $(el)
+ ?.find(".fd-infor .tick")
+ ?.text()
+ ?.trim()
+ ?.replace(/[\s\n]+/g, " ")
+ ?.split(" ")
+ ?.pop() || null,
});
});