mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
feat: initial project setup for AniKatoAPI
- Express.js server with Vercel deployment support - Complete API endpoints for anikototv.to anime data - Home, search, info, episodes, stream, schedule endpoints - Category filtering and genre support - Caching system with 5-minute TTL - CORS configuration - Public documentation page - Docker and Render deployment configs - MIT License
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { extractStreamInfo } from "../extractors/streamInfo.extractor.js";
|
||||
import { getCache, setCache } from "../helper/cache.helper.js";
|
||||
|
||||
const getStreamInfo = async (req, res, next) => {
|
||||
try {
|
||||
const { id, server = "hd-1", type = "sub" } = req.query;
|
||||
|
||||
if (!id) {
|
||||
return res.status(400).json({ success: false, message: "Episode ID is required" });
|
||||
}
|
||||
|
||||
const cacheKey = `stream_${id}_${server}_${type}`;
|
||||
const cached = getCache(cacheKey);
|
||||
if (cached) {
|
||||
return res.json({ success: true, results: cached });
|
||||
}
|
||||
|
||||
const data = await extractStreamInfo(id, server, type);
|
||||
setCache(cacheKey, data);
|
||||
res.json({ success: true, results: data });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
export { getStreamInfo };
|
||||
Reference in New Issue
Block a user