hianimez-api / src /controllers /streamInfo.controller.js
S VIVEGANANDAN
fix: resolve 403 error and clean repo
5769f09
import { extractStreamingInfo } from "../extractors/streamInfo.extractor.js";
export const getStreamInfo = async (req, res, fallback = false) => {
try {
const input = req.query.id;
const server = req.query.server;
const type = req.query.type;
const match = input.match(/ep=(\d+)/);
if (!match) throw new Error("Invalid URL format");
const finalId = match[1];
const streamingInfo = await extractStreamingInfo(finalId, server, type, fallback);
return streamingInfo;
} catch (e) {
console.error(e);
return { error: e.message };
}
};