minify again

This commit is contained in:
himanshu8443
2025-07-13 11:25:52 +05:30
parent 4d450e5be5
commit bd060abce3
139 changed files with 139 additions and 10578 deletions

View File

@@ -1,22 +1 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.genres = exports.catalog = void 0;
exports.catalog = [
{
title: "Popular Movies",
filter: "/top/catalog/movie/top.json",
},
{
title: "Popular TV Shows",
filter: "/top/catalog/series/top.json",
},
{
title: "Featured Movies",
filter: "/imdbRating/catalog/movie/imdbRating.json",
},
{
title: "Featured TV Shows",
filter: "/imdbRating/catalog/series/imdbRating.json",
},
];
exports.genres = [];
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.genres=exports.catalog=void 0,exports.catalog=[{title:"Popular Movies",filter:"/top/catalog/movie/top.json"},{title:"Popular TV Shows",filter:"/top/catalog/series/top.json"},{title:"Featured Movies",filter:"/imdbRating/catalog/movie/imdbRating.json"},{title:"Featured TV Shows",filter:"/imdbRating/catalog/series/imdbRating.json"}],exports.genres=[];

100
dist/autoEmbed/meta.js vendored
View File

@@ -1,99 +1 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMeta = void 0;
const getMeta = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link, providerContext, }) {
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
const axios = providerContext.axios;
try {
console.log("all", link);
const res = yield axios.get(link);
const data = res.data;
const meta = {
title: "",
synopsis: "",
image: "",
imdbId: ((_b = data === null || data === void 0 ? void 0 : data.meta) === null || _b === void 0 ? void 0 : _b.imdb_id) || "",
type: ((_c = data === null || data === void 0 ? void 0 : data.meta) === null || _c === void 0 ? void 0 : _c.type) || "movie",
};
const links = [];
let directLinks = [];
let season = new Map();
if (meta.type === "series") {
(_e = (_d = data === null || data === void 0 ? void 0 : data.meta) === null || _d === void 0 ? void 0 : _d.videos) === null || _e === void 0 ? void 0 : _e.map((video) => {
var _a, _b, _c, _d, _e, _f, _g, _h;
if ((video === null || video === void 0 ? void 0 : video.season) <= 0)
return;
if (!season.has(video === null || video === void 0 ? void 0 : video.season)) {
season.set(video === null || video === void 0 ? void 0 : video.season, []);
}
season.get(video === null || video === void 0 ? void 0 : video.season).push({
title: "Episode " + (video === null || video === void 0 ? void 0 : video.episode),
type: "series",
link: JSON.stringify({
title: (_a = data === null || data === void 0 ? void 0 : data.meta) === null || _a === void 0 ? void 0 : _a.name,
imdbId: (_b = data === null || data === void 0 ? void 0 : data.meta) === null || _b === void 0 ? void 0 : _b.imdb_id,
season: (_c = video === null || video === void 0 ? void 0 : video.id) === null || _c === void 0 ? void 0 : _c.split(":")[1],
episode: (_d = video === null || video === void 0 ? void 0 : video.id) === null || _d === void 0 ? void 0 : _d.split(":")[2],
type: (_e = data === null || data === void 0 ? void 0 : data.meta) === null || _e === void 0 ? void 0 : _e.type,
tmdbId: ((_g = (_f = data === null || data === void 0 ? void 0 : data.meta) === null || _f === void 0 ? void 0 : _f.moviedb_id) === null || _g === void 0 ? void 0 : _g.toString()) || "",
year: (_h = data === null || data === void 0 ? void 0 : data.meta) === null || _h === void 0 ? void 0 : _h.year,
}),
});
});
const keys = Array.from(season.keys());
keys.sort();
keys.map((key) => {
directLinks = season.get(key);
links.push({
title: `Season ${key}`,
directLinks: directLinks,
});
});
}
else {
console.log("all meta Mv🔥🔥", meta);
links.push({
title: (_f = data === null || data === void 0 ? void 0 : data.meta) === null || _f === void 0 ? void 0 : _f.name,
directLinks: [
{
title: "Movie",
type: "movie",
link: JSON.stringify({
title: (_g = data === null || data === void 0 ? void 0 : data.meta) === null || _g === void 0 ? void 0 : _g.name,
imdbId: (_h = data === null || data === void 0 ? void 0 : data.meta) === null || _h === void 0 ? void 0 : _h.imdb_id,
season: "",
episode: "",
type: (_j = data === null || data === void 0 ? void 0 : data.meta) === null || _j === void 0 ? void 0 : _j.type,
tmdbId: ((_l = (_k = data === null || data === void 0 ? void 0 : data.meta) === null || _k === void 0 ? void 0 : _k.moviedb_id) === null || _l === void 0 ? void 0 : _l.toString()) || "",
year: (_m = data === null || data === void 0 ? void 0 : data.meta) === null || _m === void 0 ? void 0 : _m.year,
}),
},
],
});
}
return Object.assign(Object.assign({}, meta), { linkList: links });
}
catch (err) {
console.error(err);
return {
title: "",
synopsis: "",
image: "",
imdbId: "",
type: "movie",
linkList: [],
};
}
});
};
exports.getMeta = getMeta;
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(_a){return __awaiter(this,arguments,void 0,function*({link:link,providerContext:providerContext}){var _b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m;const axios=providerContext.axios;try{const data=(yield axios.get(link)).data,meta={title:"",synopsis:"",image:"",imdbId:(null===(_b=null==data?void 0:data.meta)||void 0===_b?void 0:_b.imdb_id)||"",type:(null===(_c=null==data?void 0:data.meta)||void 0===_c?void 0:_c.type)||"movie"},links=[];let directLinks=[],season=new Map;if("series"===meta.type){null===(_e=null===(_d=null==data?void 0:data.meta)||void 0===_d?void 0:_d.videos)||void 0===_e||_e.map(video=>{var _a,_b,_c,_d,_e,_f,_g,_h;(null==video?void 0:video.season)<=0||(season.has(null==video?void 0:video.season)||season.set(null==video?void 0:video.season,[]),season.get(null==video?void 0:video.season).push({title:"Episode "+(null==video?void 0:video.episode),type:"series",link:JSON.stringify({title:null===(_a=null==data?void 0:data.meta)||void 0===_a?void 0:_a.name,imdbId:null===(_b=null==data?void 0:data.meta)||void 0===_b?void 0:_b.imdb_id,season:null===(_c=null==video?void 0:video.id)||void 0===_c?void 0:_c.split(":")[1],episode:null===(_d=null==video?void 0:video.id)||void 0===_d?void 0:_d.split(":")[2],type:null===(_e=null==data?void 0:data.meta)||void 0===_e?void 0:_e.type,tmdbId:(null===(_g=null===(_f=null==data?void 0:data.meta)||void 0===_f?void 0:_f.moviedb_id)||void 0===_g?void 0:_g.toString())||"",year:null===(_h=null==data?void 0:data.meta)||void 0===_h?void 0:_h.year})}))});const keys=Array.from(season.keys());keys.sort(),keys.map(key=>{directLinks=season.get(key),links.push({title:`Season ${key}`,directLinks:directLinks})})}else links.push({title:null===(_f=null==data?void 0:data.meta)||void 0===_f?void 0:_f.name,directLinks:[{title:"Movie",type:"movie",link:JSON.stringify({title:null===(_g=null==data?void 0:data.meta)||void 0===_g?void 0:_g.name,imdbId:null===(_h=null==data?void 0:data.meta)||void 0===_h?void 0:_h.imdb_id,season:"",episode:"",type:null===(_j=null==data?void 0:data.meta)||void 0===_j?void 0:_j.type,tmdbId:(null===(_l=null===(_k=null==data?void 0:data.meta)||void 0===_k?void 0:_k.moviedb_id)||void 0===_l?void 0:_l.toString())||"",year:null===(_m=null==data?void 0:data.meta)||void 0===_m?void 0:_m.year})}]});return Object.assign(Object.assign({},meta),{linkList:links})}catch(err){return{title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]}}})};exports.getMeta=getMeta;

View File

@@ -1,102 +1 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSearchPosts = exports.getPosts = void 0;
const getPosts = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ filter, signal, providerContext, }) {
try {
const catalog = [];
const url = "https://cinemeta-catalogs.strem.io" + filter;
console.log("allGetPostUrl", url);
const res = yield providerContext.axios.get(url, {
headers: providerContext.commonHeaders,
signal,
});
const data = res.data;
data === null || data === void 0 ? void 0 : data.metas.map((result) => {
const title = result === null || result === void 0 ? void 0 : result.name;
const id = (result === null || result === void 0 ? void 0 : result.imdb_id) || (result === null || result === void 0 ? void 0 : result.id);
const type = result === null || result === void 0 ? void 0 : result.type;
const image = result === null || result === void 0 ? void 0 : result.poster;
if (id) {
catalog.push({
title: title,
link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,
image: image,
});
}
});
console.log("catalog", catalog.length);
return catalog;
}
catch (err) {
console.error("AutoEmbed error ", err);
return [];
}
});
};
exports.getPosts = getPosts;
const getSearchPosts = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ searchQuery, page,
// providerValue,
signal, providerContext, }) {
try {
if (page > 1) {
return [];
}
const catalog = [];
const url1 = `https://v3-cinemeta.strem.io/catalog/series/top/search=${encodeURI(searchQuery)}.json`;
const url2 = `https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI(searchQuery)}.json`;
const res = yield providerContext.axios.get(url1, {
headers: providerContext.commonHeaders,
signal,
});
const data = res.data;
data === null || data === void 0 ? void 0 : data.metas.map((result) => {
const title = result.name || "";
const id = (result === null || result === void 0 ? void 0 : result.imdb_id) || (result === null || result === void 0 ? void 0 : result.id);
const image = result === null || result === void 0 ? void 0 : result.poster;
const type = result === null || result === void 0 ? void 0 : result.type;
if (id) {
catalog.push({
title: title,
link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,
image: image,
});
}
});
const res2 = yield providerContext.axios.get(url2, {
headers: providerContext.commonHeaders,
signal,
});
const data2 = res2.data;
data2 === null || data2 === void 0 ? void 0 : data2.metas.map((result) => {
const title = (result === null || result === void 0 ? void 0 : result.name) || "";
const id = (result === null || result === void 0 ? void 0 : result.imdb_id) || (result === null || result === void 0 ? void 0 : result.id);
const image = result === null || result === void 0 ? void 0 : result.poster;
const type = result === null || result === void 0 ? void 0 : result.type;
if (id) {
catalog.push({
title: title,
link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,
image: image,
});
}
});
return catalog;
}
catch (err) {
console.error("AutoEmbed error ", err);
return [];
}
});
};
exports.getSearchPosts = getSearchPosts;
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSearchPosts=exports.getPosts=void 0;const getPosts=function(_a){return __awaiter(this,arguments,void 0,function*({filter:filter,signal:signal,providerContext:providerContext}){try{const catalog=[],url="https://cinemeta-catalogs.strem.io"+filter,data=(yield providerContext.axios.get(url,{headers:providerContext.commonHeaders,signal:signal})).data;return null==data||data.metas.map(result=>{const title=null==result?void 0:result.name,id=(null==result?void 0:result.imdb_id)||(null==result?void 0:result.id),type=null==result?void 0:result.type,image=null==result?void 0:result.poster;id&&catalog.push({title:title,link:`https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,image:image})}),catalog}catch(err){return[]}})};exports.getPosts=getPosts;const getSearchPosts=function(_a){return __awaiter(this,arguments,void 0,function*({searchQuery:searchQuery,page:page,signal:signal,providerContext:providerContext}){try{if(page>1)return[];const catalog=[],url1=`https://v3-cinemeta.strem.io/catalog/series/top/search=${encodeURI(searchQuery)}.json`,url2=`https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI(searchQuery)}.json`,data=(yield providerContext.axios.get(url1,{headers:providerContext.commonHeaders,signal:signal})).data;null==data||data.metas.map(result=>{const title=result.name||"",id=(null==result?void 0:result.imdb_id)||(null==result?void 0:result.id),image=null==result?void 0:result.poster,type=null==result?void 0:result.type;id&&catalog.push({title:title,link:`https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,image:image})});const data2=(yield providerContext.axios.get(url2,{headers:providerContext.commonHeaders,signal:signal})).data;return null==data2||data2.metas.map(result=>{const title=(null==result?void 0:result.name)||"",id=(null==result?void 0:result.imdb_id)||(null==result?void 0:result.id),image=null==result?void 0:result.poster,type=null==result?void 0:result.type;id&&catalog.push({title:title,link:`https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,image:image})}),catalog}catch(err){return[]}})};exports.getSearchPosts=getSearchPosts;

View File

@@ -1,234 +1 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0;
exports.getRiveStream = getRiveStream;
const getStream = (_a) => __awaiter(void 0, [_a], void 0, function* ({ link: id, type, providerContext, }) {
try {
const streams = [];
const { imdbId, season, episode, title, tmdbId, year } = JSON.parse(id);
yield getRiveStream(tmdbId, episode, season, type, streams, providerContext);
return streams;
}
catch (err) {
console.error(err);
return [];
}
});
exports.getStream = getStream;
function getRiveStream(tmdId, episode, season, type, Streams, providerContext) {
return __awaiter(this, void 0, void 0, function* () {
const secret = generateSecretKey(Number(tmdId));
const servers = [
"flowcast",
"shadow",
"asiacloud",
"hindicast",
"anime",
"animez",
"guard",
"curve",
"hq",
"ninja",
"alpha",
"kaze",
"zenesis",
"genesis",
"zenith",
"ghost",
"halo",
"kinoecho",
"ee3",
"volt",
"putafilme",
"ophim",
"kage",
];
const baseUrl = yield providerContext.getBaseUrl("rive");
const cors = process.env.CORS_PRXY ? process.env.CORS_PRXY + "?url=" : "";
console.log("CORS: " + cors);
const route = type === "series"
? `/api/backendfetch?requestID=tvVideoProvider&id=${tmdId}&season=${season}&episode=${episode}&secretKey=${secret}&service=`
: `/api/backendfetch?requestID=movieVideoProvider&id=${tmdId}&secretKey=${secret}&service=`;
const url = cors
? cors + encodeURIComponent(baseUrl + route)
: baseUrl + route;
yield Promise.all(servers.map((server) => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d, _e, _f;
console.log("Rive: " + url + server);
try {
const res = yield providerContext.axios.get(url + server, {
timeout: 4000,
headers: providerContext.commonHeaders,
});
const subtitles = [];
if ((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.captions) {
(_d = (_c = res.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.captions.forEach((sub) => {
var _a, _b;
subtitles.push({
language: ((_a = sub === null || sub === void 0 ? void 0 : sub.label) === null || _a === void 0 ? void 0 : _a.slice(0, 2)) || "Und",
uri: sub === null || sub === void 0 ? void 0 : sub.file,
title: (sub === null || sub === void 0 ? void 0 : sub.label) || "Undefined",
type: ((_b = sub === null || sub === void 0 ? void 0 : sub.file) === null || _b === void 0 ? void 0 : _b.endsWith(".vtt"))
? "text/vtt"
: "application/x-subrip",
});
});
}
(_f = (_e = res.data) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.sources.forEach((source) => {
Streams.push({
server: (source === null || source === void 0 ? void 0 : source.source) + "-" + (source === null || source === void 0 ? void 0 : source.quality),
link: source === null || source === void 0 ? void 0 : source.url,
type: (source === null || source === void 0 ? void 0 : source.format) === "hls" ? "m3u8" : "mp4",
quality: source === null || source === void 0 ? void 0 : source.quality,
subtitles: subtitles,
});
});
}
catch (e) {
console.log(e);
}
})));
});
}
function generateSecretKey(id) {
// Array of secret key fragments - updated array from the new implementation
const c = [
"Yhv40uKAZa",
"nn8YU4yBA",
"uNeH",
"ehK",
"jT0",
"n5G",
"99R",
"MvB1M",
"DQtPCh",
"GBRjk4k4I",
"CzIOoa95UT",
"BLE8s",
"GDZlc7",
"Fz45T",
"JW6lWn",
"DE3g4uw0i",
"18KxmYizv",
"8ji",
"JUDdNMnZ",
"oGpBippPgm",
"7De8Pg",
"Zv6",
"VHT9TVN",
"bYH6m",
"aK1",
"WcWH6jU",
"Q47YEMi4k",
"vRD3A",
"CGOsfJO",
"BLn8",
"RgK0drv7l",
"oPTfGCn3a",
"MkpMDkttW9",
"VNI1fPM",
"XNFi6",
"6cq",
"4LvTksXoEI",
"1rRa2KOZB0",
"zoOGRb8HT2",
"mhcXDtvz",
"NUmexFY2Ur",
"6BIMdvSZ",
"Tr0zU2vjRd",
"QPR",
"fhOqJR",
"R9VnFY",
"xkZ99D6S",
"umY7E",
"5Ds8qyDq",
"Cc6jy09y3",
"yvU3iR",
"Bg07zY",
"GccECglg",
"VYd",
"6vOiXqz",
"7xX",
"UdRrbEzF",
"fE6wc",
"BUd25Rb",
"lxq5Zum89o",
];
// Handle undefined input
if (id === undefined) {
return "rive";
}
try {
let fragment, insertPos;
// Convert input to string
const idStr = String(id);
// Updated string hash function to match the new implementation
/* eslint-disable no-bitwise */
const generateStringHash = function (input) {
input = String(input);
let hash = 0;
for (let i = 0; i < input.length; i++) {
const char = input.charCodeAt(i);
hash =
((char + (hash << 6) + (hash << 16) - hash) ^ (char << i % 5)) >>> 0;
}
hash ^= hash >>> 13;
hash = (1540483477 * hash) >>> 0;
return (hash ^= hash >>> 15).toString(16).padStart(8, "0");
};
// Updated MurmurHash-like function to match the new implementation
const applyMurmurHash = function (input) {
const str = String(input);
let hash = 3735928559 ^ str.length;
for (let i = 0; i < str.length; i++) {
let char = str.charCodeAt(i);
char ^= ((i + 31) * 131) & 255;
hash =
(668265261 *
(hash = (((hash << 7) | (hash >>> 25)) >>> 0) ^ char)) >>>
0;
}
hash ^= hash >>> 16;
hash = (2246822507 * hash) >>> 0;
hash ^= hash >>> 13;
hash = (3266489909 * hash) >>> 0;
return (hash ^= hash >>> 16).toString(16).padStart(8, "0");
};
/* eslint-enable no-bitwise */
// Generate the encoded hash using the new implementation
const encodedHash = btoa(applyMurmurHash(generateStringHash(idStr)));
// Different handling for non-numeric vs numeric inputs
if (isNaN(Number(id))) {
// For non-numeric inputs, sum the character codes
const charSum = idStr
.split("")
.reduce((sum, char) => sum + char.charCodeAt(0), 0);
// Select array element or fallback to base64 encoded input
fragment = c[charSum % c.length] || btoa(idStr);
// Calculate insertion position
insertPos = Math.floor((charSum % encodedHash.length) / 2);
}
else {
// For numeric inputs, use the number directly
const numId = Number(id);
fragment = c[numId % c.length] || btoa(idStr);
// Calculate insertion position
insertPos = Math.floor((numId % encodedHash.length) / 2);
}
// Construct the final key by inserting the selected value into the base64 string
return (encodedHash.slice(0, insertPos) + fragment + encodedHash.slice(insertPos));
}
catch (error) {
// Return fallback value if any errors occur
return "topSecret";
}
}
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0,exports.getRiveStream=getRiveStream;const getStream=_a=>__awaiter(void 0,[_a],void 0,function*({link:id,type:type,providerContext:providerContext}){try{const streams=[],{imdbId:imdbId,season:season,episode:episode,title:title,tmdbId:tmdbId,year:year}=JSON.parse(id);return yield getRiveStream(tmdbId,episode,season,type,streams,providerContext),streams}catch(err){return[]}});function getRiveStream(tmdId,episode,season,type,Streams,providerContext){return __awaiter(this,void 0,void 0,function*(){const secret=generateSecretKey(Number(tmdId)),baseUrl=yield providerContext.getBaseUrl("rive"),cors=process.env.CORS_PRXY?process.env.CORS_PRXY+"?url=":"",route="series"===type?`/api/backendfetch?requestID=tvVideoProvider&id=${tmdId}&season=${season}&episode=${episode}&secretKey=${secret}&service=`:`/api/backendfetch?requestID=movieVideoProvider&id=${tmdId}&secretKey=${secret}&service=`,url=cors?cors+encodeURIComponent(baseUrl+route):baseUrl+route;yield Promise.all(["flowcast","shadow","asiacloud","hindicast","anime","animez","guard","curve","hq","ninja","alpha","kaze","zenesis","genesis","zenith","ghost","halo","kinoecho","ee3","volt","putafilme","ophim","kage"].map(server=>__awaiter(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f;try{const res=yield providerContext.axios.get(url+server,{timeout:4e3,headers:providerContext.commonHeaders}),subtitles=[];(null===(_b=null===(_a=res.data)||void 0===_a?void 0:_a.data)||void 0===_b?void 0:_b.captions)&&(null===(_d=null===(_c=res.data)||void 0===_c?void 0:_c.data)||void 0===_d||_d.captions.forEach(sub=>{var _a,_b;subtitles.push({language:(null===(_a=null==sub?void 0:sub.label)||void 0===_a?void 0:_a.slice(0,2))||"Und",uri:null==sub?void 0:sub.file,title:(null==sub?void 0:sub.label)||"Undefined",type:(null===(_b=null==sub?void 0:sub.file)||void 0===_b?void 0:_b.endsWith(".vtt"))?"text/vtt":"application/x-subrip"})})),null===(_f=null===(_e=res.data)||void 0===_e?void 0:_e.data)||void 0===_f||_f.sources.forEach(source=>{Streams.push({server:(null==source?void 0:source.source)+"-"+(null==source?void 0:source.quality),link:null==source?void 0:source.url,type:"hls"===(null==source?void 0:source.format)?"m3u8":"mp4",quality:null==source?void 0:source.quality,subtitles:subtitles})})}catch(e){}})))})}function generateSecretKey(id){const c=["Yhv40uKAZa","nn8YU4yBA","uNeH","ehK","jT0","n5G","99R","MvB1M","DQtPCh","GBRjk4k4I","CzIOoa95UT","BLE8s","GDZlc7","Fz45T","JW6lWn","DE3g4uw0i","18KxmYizv","8ji","JUDdNMnZ","oGpBippPgm","7De8Pg","Zv6","VHT9TVN","bYH6m","aK1","WcWH6jU","Q47YEMi4k","vRD3A","CGOsfJO","BLn8","RgK0drv7l","oPTfGCn3a","MkpMDkttW9","VNI1fPM","XNFi6","6cq","4LvTksXoEI","1rRa2KOZB0","zoOGRb8HT2","mhcXDtvz","NUmexFY2Ur","6BIMdvSZ","Tr0zU2vjRd","QPR","fhOqJR","R9VnFY","xkZ99D6S","umY7E","5Ds8qyDq","Cc6jy09y3","yvU3iR","Bg07zY","GccECglg","VYd","6vOiXqz","7xX","UdRrbEzF","fE6wc","BUd25Rb","lxq5Zum89o"];if(void 0===id)return"rive";try{let fragment,insertPos;const idStr=String(id),encodedHash=btoa(function(input){const str=String(input);let hash=3735928559^str.length;for(let i=0;i<str.length;i++){let char=str.charCodeAt(i);char^=131*(i+31)&255,hash=668265261*(hash=(hash<<7|hash>>>25)>>>0^char)>>>0}return hash^=hash>>>16,hash=2246822507*hash>>>0,hash^=hash>>>13,hash=3266489909*hash>>>0,(hash^=hash>>>16).toString(16).padStart(8,"0")}(function(input){input=String(input);let hash=0;for(let i=0;i<input.length;i++){const char=input.charCodeAt(i);hash=(char+(hash<<6)+(hash<<16)-hash^char<<i%5)>>>0}return hash^=hash>>>13,hash=1540483477*hash>>>0,(hash^=hash>>>15).toString(16).padStart(8,"0")}(idStr)));if(isNaN(Number(id))){const charSum=idStr.split("").reduce((sum,char)=>sum+char.charCodeAt(0),0);fragment=c[charSum%c.length]||btoa(idStr),insertPos=Math.floor(charSum%encodedHash.length/2)}else{const numId=Number(id);fragment=c[numId%c.length]||btoa(idStr),insertPos=Math.floor(numId%encodedHash.length/2)}return encodedHash.slice(0,insertPos)+fragment+encodedHash.slice(insertPos)}catch(error){return"topSecret"}}exports.getStream=getStream;