This commit is contained in:
Tejas Panchal
2026-03-01 15:58:22 +05:30
parent 19e3899e6d
commit e28cc3256f

View File

@@ -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();