mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 19:05:11 +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:
@@ -1,20 +1,19 @@
|
||||
import * as cheerio from "cheerio";
|
||||
import axios from "axios";
|
||||
import { headers } from "../configs/header.config.js";
|
||||
import { BASE_URL } from "../configs/dataUrl.js";
|
||||
import { URLS } from "../configs/dataUrl.js";
|
||||
|
||||
const extractEpisodeList = async (id) => {
|
||||
const extractEpisodeList = async (slug) => {
|
||||
try {
|
||||
const url = `${BASE_URL}/anime/${id}`;
|
||||
const url = URLS.watch(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("/").pop() || "";
|
||||
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 japaneseTitle = $(el).find(".ep-jp").text().trim() || "";
|
||||
const filler = $(el).hasClass("filler") || false;
|
||||
|
||||
if (epId) {
|
||||
@@ -22,7 +21,6 @@ const extractEpisodeList = async (id) => {
|
||||
id: epId,
|
||||
episode_no: epNumber,
|
||||
title,
|
||||
japaneseTitle,
|
||||
filler
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user