mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
fix: update extractors to match actual anikototv.to structure
- Analyzed actual HTML structure of anikototv.to - Updated all extractors with correct CSS selectors - Changed ID-based to slug-based lookups - Updated URL patterns to match actual website - Fixed stream info to use AJAX server list - Improved error handling
This commit is contained in:
@@ -7,30 +7,43 @@ import { extractPages } from "../helper/extractPages.helper.js";
|
||||
|
||||
const extractCategory = async (category, page = 1) => {
|
||||
try {
|
||||
const url = URLS.category(category);
|
||||
let url;
|
||||
if (category.startsWith("genre/")) {
|
||||
url = URLS.genre(category.replace("genre/", ""));
|
||||
} else if (category.startsWith("type/")) {
|
||||
url = URLS.type(category.replace("type/", ""));
|
||||
} else if (category.startsWith("status/")) {
|
||||
url = URLS.status(category.replace("status/", ""));
|
||||
} else {
|
||||
url = `${URLS.home}/${category}`;
|
||||
}
|
||||
|
||||
const $ = await extractPages(url, page);
|
||||
const totalPages = countPages($);
|
||||
|
||||
const results = [];
|
||||
$(".film_list-wrap .flw-item, .film-detail").each((i, el) => {
|
||||
const id = $(el).find("a").attr("href")?.split("/").pop() || "";
|
||||
const slug = $(el).find("a").attr("href")?.split("/watch/").pop() || "";
|
||||
const poster = $(el).find("img").attr("src") || "";
|
||||
const title = $(el).find(".film-name a, .dynamic-name").text().trim() || "";
|
||||
const japaneseTitle = $(el).find(".fd-infor .fdi-item:first-child").text().trim() || "";
|
||||
const showType = $(el).find(".fd-infor .fdi-item:nth-child(2)").text().trim() || "";
|
||||
const sub = parseInt($(el).find(".tick-sub").text().trim()) || 0;
|
||||
const dub = parseInt($(el).find(".tick-dub").text().trim()) || 0;
|
||||
const eps = parseInt($(el).find(".tick-eps").text().trim()) || 0;
|
||||
const adultContent = $(el).find(".tick-adult, .adult-badge").length > 0;
|
||||
const title = $(el).find(".film-name a, .name.d-title").text().trim() || "";
|
||||
const japaneseTitle = $(el).find(".name.d-title").attr("data-jp") || "";
|
||||
const sub = parseInt($(el).find(".ep-status.sub span").text().trim()) || 0;
|
||||
const dub = parseInt($(el).find(".ep-status.dub span").text().trim()) || 0;
|
||||
const total = parseInt($(el).find(".ep-status.total span").text().trim()) || 0;
|
||||
const type = $(el).find(".meta .inner .right, .fdi-item:nth-child(2)").text().trim() || "";
|
||||
const rating = $(el).find(".rating, .fdi-item:nth-child(3)").text().trim() || "";
|
||||
|
||||
if (id) {
|
||||
if (slug) {
|
||||
results.push({
|
||||
id,
|
||||
slug,
|
||||
poster,
|
||||
title,
|
||||
japaneseTitle,
|
||||
tvInfo: { showType, sub, dub, eps },
|
||||
adultContent
|
||||
sub,
|
||||
dub,
|
||||
total,
|
||||
type,
|
||||
rating
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user