aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRitesh Ghosh <[email protected]>2023-11-22 15:15:07 +0530
committerRitesh Ghosh <[email protected]>2023-11-22 15:15:07 +0530
commit4afc916f7e9c90d9a19d2e4b7891c0c5bf83df08 (patch)
treef4703a7cbdede2154fa6951a1d771d9e4799df3e
parentf2a47e300304ed8754c5c33937143e8af1a07caf (diff)
downloadaniwatch-api-4afc916f7e9c90d9a19d2e4b7891c0c5bf83df08.tar.xz
aniwatch-api-4afc916f7e9c90d9a19d2e4b7891c0c5bf83df08.zip
fix(#4 bug): add otherInfo episodes clarification
-rw-r--r--src/parsers/homePage.ts23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/parsers/homePage.ts b/src/parsers/homePage.ts
index d3a231a..53cf721 100644
--- a/src/parsers/homePage.ts
+++ b/src/parsers/homePage.ts
@@ -45,7 +45,8 @@ async function scrapeHomePage(): Promise<ScrapedHomePage | HttpError> {
const otherInfo = $(el)
.find(".deslide-item-content .sc-detail .scd-item")
.map((i, el) => $(el).text().trim())
- .get();
+ .get()
+ .slice(0, -1);
res.spotlightAnimes.push({
rank:
@@ -81,6 +82,26 @@ async function scrapeHomePage(): Promise<ScrapedHomePage | HttpError> {
.find(".deslide-item-content .desi-head-title.dynamic-name")
?.attr("data-jname")
?.trim(),
+ episodes: {
+ sub:
+ Number(
+ $(el)
+ .find(
+ ".deslide-item-content .sc-detail .scd-item .tick-item.tick-sub"
+ )
+ ?.text()
+ ?.trim()
+ ) || null,
+ dub:
+ Number(
+ $(el)
+ .find(
+ ".deslide-item-content .sc-detail .scd-item .tick-item.tick-dub"
+ )
+ ?.text()
+ ?.trim()
+ ) || null,
+ },
otherInfo,
});
});