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:
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ
2026-06-08 15:18:27 +05:30
parent 3815521b0d
commit 1906ba4a34
20 changed files with 344 additions and 308 deletions
+26 -13
View File
@@ -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
});
}
});