feat: added episode count to top airing anime
This commit is contained in:
+2
-29
@@ -5,6 +5,7 @@ import {
|
||||
ACCEPT_ENCODING_HEADER,
|
||||
extractTop10Animes,
|
||||
extractAnimes,
|
||||
extractMostPopularAnimes,
|
||||
} from "../utils/index.js";
|
||||
import axios, { AxiosError } from "axios";
|
||||
import createHttpError, { type HttpError } from "http-errors";
|
||||
@@ -158,35 +159,7 @@ async function scrapeHomePage(): Promise<ScrapedHomePage | HttpError> {
|
||||
}
|
||||
});
|
||||
|
||||
const topAiringSelector: SelectorType =
|
||||
"#anime-featured .row div:nth-of-type(1) .anif-block-ul ul li";
|
||||
$(topAiringSelector).each((i, el) => {
|
||||
const otherInfo = $(el)
|
||||
.find(".fd-infor .fdi-item")
|
||||
.map((i, el) => $(el).text().trim())
|
||||
.get();
|
||||
|
||||
res.topAiringAnimes.push({
|
||||
id: $(el)
|
||||
.find(".film-detail .film-name .dynamic-name")
|
||||
?.attr("href")
|
||||
?.slice(1)
|
||||
?.trim(),
|
||||
name: $(el)
|
||||
.find(".film-detail .film-name .dynamic-name")
|
||||
?.attr("title")
|
||||
?.trim(),
|
||||
jname: $(el)
|
||||
.find(".film-detail .film-name .dynamic-name")
|
||||
?.attr("data-jname")
|
||||
?.trim(),
|
||||
poster: $(el)
|
||||
.find(".film-poster a .film-poster-img")
|
||||
?.attr("data-src")
|
||||
?.trim(),
|
||||
otherInfo,
|
||||
});
|
||||
});
|
||||
res.topAiringAnimes = extractMostPopularAnimes($, "#anime-featured .row div:nth-of-type(1) .anif-block-ul ul li");
|
||||
|
||||
return res;
|
||||
} catch (err: any) {
|
||||
|
||||
Reference in New Issue
Block a user