mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 02:45:10 +00:00
- 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
25 lines
688 B
JavaScript
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 }; |