mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
fix: critical fixes for 14 broken endpoints
- Fixed ALL CSS selectors to match actual anikototv.to HTML - Fixed search results returning empty data array - Fixed anime info returning empty fields - Fixed episode list returning 0 episodes - Fixed most-popular returning empty data - Fixed random endpoint 500 error - Fixed filter endpoint 500 error - Fixed suggestions returning empty array - Added /api/genre/:name and /api/type/:name routes - Fixed watch page server/episode extraction - Fixed rating field to return clean value
This commit is contained in:
@@ -9,24 +9,30 @@ const extractEpisodeList = async (slug) => {
|
||||
const { data } = await axios.get(url, { headers });
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const episodes = [];
|
||||
$(".episodes-list .ep-item, .ss-list a").each((i, el) => {
|
||||
const epId = $(el).attr("data-id") || $(el).attr("href")?.split("/ep-").pop() || "";
|
||||
const epNumber = parseInt($(el).find(".ep-number, .ep-num").text().trim()) || i + 1;
|
||||
const title = $(el).find(".ep-title, .ep-name").text().trim() || "";
|
||||
const filler = $(el).hasClass("filler") || false;
|
||||
const animeId = parseInt($("#watch-main").attr("data-id")) || 0;
|
||||
|
||||
if (epId) {
|
||||
episodes.push({
|
||||
id: epId,
|
||||
episode_no: epNumber,
|
||||
title,
|
||||
filler
|
||||
});
|
||||
}
|
||||
const episodes = [];
|
||||
$("#w-episodes a[data-num], #w-episodes a[data-slug]").each((i, el) => {
|
||||
const epId = $(el).attr("data-id") || $(el).attr("data-ep-id") || "";
|
||||
const epNum = parseInt($(el).attr("data-num")) || i + 1;
|
||||
const epSlug = $(el).attr("data-slug") || "";
|
||||
const epTitle = $(el).find(".ep-title, .ep-name").text().trim() || "";
|
||||
const isActive = $(el).hasClass("active") || false;
|
||||
const href = $(el).attr("href") || "";
|
||||
|
||||
episodes.push({
|
||||
id: epId,
|
||||
episode_no: epNum,
|
||||
slug: epSlug,
|
||||
title: epTitle,
|
||||
active: isActive,
|
||||
href
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
animeId,
|
||||
slug,
|
||||
totalEpisodes: episodes.length,
|
||||
episodes
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user