mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 19:05:11 +00:00
feat: complete streaming and AJAX endpoint support
- Add stream URL extraction via /ajax/server?get={linkId}
- Add mapper API integration for gogoanime/anivibe servers
- Add /api/seasons/:id endpoint
- Add /api/watch-order/:id endpoint
- Add /api/episodes-ajax/:id endpoint
- Add /api/servers endpoint
- Add genre/type/status/rating ID mappings
- Fix filter to use correct numeric IDs
- Fix watch page data attribute extraction
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { extractStreamInfo } from "../extractors/streamInfo.extractor.js";
|
||||
import { extractStreamInfo, extractServerList, extractMapperServers } from "../extractors/streamInfo.extractor.js";
|
||||
import { getCache, setCache } from "../helper/cache.helper.js";
|
||||
|
||||
const getStreamInfo = async (req, res, next) => {
|
||||
@@ -6,7 +6,7 @@ const getStreamInfo = async (req, res, next) => {
|
||||
const { id } = req.query;
|
||||
|
||||
if (!id) {
|
||||
return res.status(400).json({ success: false, message: "Episode ID is required" });
|
||||
return res.status(400).json({ success: false, message: "Link ID is required" });
|
||||
}
|
||||
|
||||
const cacheKey = `stream_${id}`;
|
||||
@@ -23,4 +23,48 @@ const getStreamInfo = async (req, res, next) => {
|
||||
}
|
||||
};
|
||||
|
||||
export { getStreamInfo };
|
||||
const getServerList = async (req, res, next) => {
|
||||
try {
|
||||
const { ids } = req.query;
|
||||
|
||||
if (!ids) {
|
||||
return res.status(400).json({ success: false, message: "Episode IDs are required" });
|
||||
}
|
||||
|
||||
const cacheKey = `servers_${ids}`;
|
||||
const cached = getCache(cacheKey);
|
||||
if (cached) {
|
||||
return res.json({ success: true, results: cached });
|
||||
}
|
||||
|
||||
const data = await extractServerList(ids);
|
||||
setCache(cacheKey, data);
|
||||
res.json({ success: true, results: data });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
const getMapperServers = async (req, res, next) => {
|
||||
try {
|
||||
const { malId, slug, timestamp } = req.query;
|
||||
|
||||
if (!malId || !slug || !timestamp) {
|
||||
return res.status(400).json({ success: false, message: "malId, slug, and timestamp are required" });
|
||||
}
|
||||
|
||||
const cacheKey = `mapper_${malId}_${slug}_${timestamp}`;
|
||||
const cached = getCache(cacheKey);
|
||||
if (cached) {
|
||||
return res.json({ success: true, results: cached });
|
||||
}
|
||||
|
||||
const data = await extractMapperServers(malId, slug, timestamp);
|
||||
setCache(cacheKey, data);
|
||||
res.json({ success: true, results: data });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
export { getStreamInfo, getServerList, getMapperServers };
|
||||
Reference in New Issue
Block a user