mirror of
https://github.com/JustAnimeCore/HiAnime-Api.git
synced 2026-04-17 22:01:44 +00:00
seasons
This commit is contained in:
@@ -9,15 +9,16 @@ async function extractSeasons(id) {
|
|||||||
const $ = cheerio.load(resp.data);
|
const $ = cheerio.load(resp.data);
|
||||||
const seasons = $(".anis-watch>.other-season>.inner>.os-list>a")
|
const seasons = $(".anis-watch>.other-season>.inner>.os-list>a")
|
||||||
.map((index, element) => {
|
.map((index, element) => {
|
||||||
|
const href = $(element).attr("href");
|
||||||
const data_number = index;
|
const data_number = index;
|
||||||
const data_id = parseInt($(element).attr("href").split("-").pop());
|
const data_id = parseInt(href.split("-").pop());
|
||||||
const season = $(element).find(".title").text().trim();
|
const season = $(element).find(".title").text().trim();
|
||||||
const title = $(element).attr("title").trim();
|
const title = $(element).attr("title").trim() || "";
|
||||||
const id = href.replace(/^\/+/, "");
|
const id = href.replace(/^\/+/, "");
|
||||||
const season_poster = $(element)
|
const style = $(element).find(".season-poster").attr("style") || "";
|
||||||
.find(".season-poster")
|
const posterMatch = style.match(/url\((.*?)\)/);
|
||||||
.attr("style")
|
const season_poster = posterMatch ? posterMatch[1] : "";
|
||||||
.match(/url\((.*?)\)/)[1];
|
|
||||||
return { id, data_number, data_id, season, title, season_poster };
|
return { id, data_number, data_id, season, title, season_poster };
|
||||||
})
|
})
|
||||||
.get();
|
.get();
|
||||||
|
|||||||
Reference in New Issue
Block a user