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:
@@ -10,18 +10,21 @@ const extractSuggestions = async (keyword) => {
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const suggestions = [];
|
||||
$(".search-suggest .film-detail, .nav-item a").each((i, el) => {
|
||||
const slug = $(el).attr("href")?.split("/watch/").pop() || "";
|
||||
const poster = $(el).find("img").attr("src") || "";
|
||||
const title = $(el).find(".film-name, .name").text().trim() || "";
|
||||
const type = $(el).find(".fdi-item:first-child").text().trim() || "";
|
||||
$("#list-items > .item").each((i, el) => {
|
||||
const slug = $(el).find("a").attr("href")?.split("/watch/").pop() || "";
|
||||
const poster = $(el).find(".ani.poster.tip > a > img").attr("src") || "";
|
||||
const title = $(el).find(".info .b1 a.name.d-title").text().trim() || "";
|
||||
const japaneseTitle = $(el).find(".info .b1 a.name.d-title").attr("data-jp") || "";
|
||||
const type = $(el).find(".info .meta .m-item:nth-child(2) label").text().trim() || "";
|
||||
const sub = parseInt($(el).find(".ep-status.sub span").text().trim()) || 0;
|
||||
const dub = parseInt($(el).find(".ep-status.dub span").text().trim()) || 0;
|
||||
|
||||
if (slug) {
|
||||
suggestions.push({ slug, poster, title, type });
|
||||
suggestions.push({ slug, poster, title, japaneseTitle, type, sub, dub });
|
||||
}
|
||||
});
|
||||
|
||||
return suggestions;
|
||||
return suggestions.slice(0, 10);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user