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,21 @@
|
||||
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 extractRandom = async () => {
|
||||
try {
|
||||
const { data } = await axios.get(`${BASE_URL}/random`, {
|
||||
const { data } = await axios.get(URLS.random, {
|
||||
headers,
|
||||
maxRedirects: 5
|
||||
});
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const slug = window.location.pathname.split("/watch/").pop() || "";
|
||||
const title = $(".film-name h1, .anisc-detail .film-name").text().trim() || "";
|
||||
const japaneseTitle = $(".film-name .alternate-title, .anisc-detail .film-name small").text().trim() || "";
|
||||
const poster = $(".film-poster img").attr("src") || "";
|
||||
const showType = $(".film-info .row .col1 .item:first-child .name").text().trim() || "";
|
||||
const type = $(".film-info .row .col1 .item:first-child .name").text().trim() || "";
|
||||
|
||||
const animeInfo = {};
|
||||
$(".anisc-info .item").each((i, el) => {
|
||||
@@ -26,10 +27,11 @@ const extractRandom = async () => {
|
||||
});
|
||||
|
||||
return {
|
||||
slug,
|
||||
title,
|
||||
japaneseTitle,
|
||||
poster,
|
||||
showType,
|
||||
type,
|
||||
animeInfo
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user