Files
AniKotoAPI/src/controllers/animeInfo.controller.js
T
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ 1906ba4a34 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
2026-06-08 15:18:27 +05:30

25 lines
688 B
JavaScript

import { extractAnimeInfo } from "../extractors/animeInfo.extractor.js";
import { getCache, setCache } from "../helper/cache.helper.js";
const getAnimeInfo = async (req, res, next) => {
try {
const { id } = req.query;
if (!id) {
return res.status(400).json({ success: false, message: "Anime slug is required" });
}
const cacheKey = `anime_${id}`;
const cached = getCache(cacheKey);
if (cached) {
return res.json({ success: true, results: cached });
}
const data = await extractAnimeInfo(id);
setCache(cacheKey, data);
res.json({ success: true, results: data });
} catch (error) {
next(error);
}
};
export { getAnimeInfo };