This commit is contained in:
himanshu8443
2025-07-11 19:17:23 +05:30
parent 6ca69cf93b
commit 13f71510d5
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(i,e,t,o){return new(t||(t=Promise))(function(l,n){function d(i){try{s(o.next(i))}catch(i){n(i)}}function v(i){try{s(o.throw(i))}catch(i){n(i)}}function s(i){var e;i.done?l(i.value):(e=i.value,e instanceof t?e:new t(function(i){i(e)})).then(d,v)}s((o=o.apply(i,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(i){return __awaiter(this,arguments,void 0,function*({link:i,providerContext:e}){var t,o,l,n,d,v,s,a,u,r,m;const p=e.axios;try{const e=(yield p.get(i)).data,y={title:"",synopsis:"",image:"",imdbId:(null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.imdb_id)||"",type:(null===(o=null==e?void 0:e.meta)||void 0===o?void 0:o.type)||"movie"},c=[];let g=[],b=new Map;if("series"===y.type){null===(n=null===(l=null==e?void 0:e.meta)||void 0===l?void 0:l.videos)||void 0===n||n.map(i=>{var t,o,l,n,d,v,s,a;(null==i?void 0:i.season)<=0||(b.has(null==i?void 0:i.season)||b.set(null==i?void 0:i.season,[]),b.get(null==i?void 0:i.season).push({title:"Episode "+(null==i?void 0:i.episode),type:"series",link:JSON.stringify({title:null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.name,imdbId:null===(o=null==e?void 0:e.meta)||void 0===o?void 0:o.imdb_id,season:null===(l=null==i?void 0:i.id)||void 0===l?void 0:l.split(":")[1],episode:null===(n=null==i?void 0:i.id)||void 0===n?void 0:n.split(":")[2],type:null===(d=null==e?void 0:e.meta)||void 0===d?void 0:d.type,tmdbId:(null===(s=null===(v=null==e?void 0:e.meta)||void 0===v?void 0:v.moviedb_id)||void 0===s?void 0:s.toString())||"",year:null===(a=null==e?void 0:e.meta)||void 0===a?void 0:a.year})}))});const i=Array.from(b.keys());i.sort(),i.map(i=>{g=b.get(i),c.push({title:`Season ${i}`,directLinks:g})})}else c.push({title:null===(d=null==e?void 0:e.meta)||void 0===d?void 0:d.name,directLinks:[{title:"Movie",type:"movie",link:JSON.stringify({title:null===(v=null==e?void 0:e.meta)||void 0===v?void 0:v.name,imdbId:null===(s=null==e?void 0:e.meta)||void 0===s?void 0:s.imdb_id,season:"",episode:"",type:null===(a=null==e?void 0:e.meta)||void 0===a?void 0:a.type,tmdbId:(null===(r=null===(u=null==e?void 0:e.meta)||void 0===u?void 0:u.moviedb_id)||void 0===r?void 0:r.toString())||"",year:null===(m=null==e?void 0:e.meta)||void 0===m?void 0:m.year})}]});return Object.assign(Object.assign({},y),{linkList:c})}catch(i){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(t,e,n,o){return new(n||(n=Promise))(function(i,s){function a(t){try{l(o.next(t))}catch(t){s(t)}}function r(t){try{l(o.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,r)}l((o=o.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSearchPosts=exports.getPosts=void 0;const getPosts=function(t){return __awaiter(this,arguments,void 0,function*({filter:t,signal:e,providerContext:n}){try{const o=[],i="https://cinemeta-catalogs.strem.io"+t,s=(yield n.axios.get(i,{headers:n.commonHeaders,signal:e})).data;return null==s||s.metas.map(t=>{const e=null==t?void 0:t.name,n=(null==t?void 0:t.imdb_id)||(null==t?void 0:t.id),i=null==t?void 0:t.type,s=null==t?void 0:t.poster;n&&o.push({title:e,link:`https://v3-cinemeta.strem.io/meta/${i}/${n}.json`,image:s})}),o}catch(t){return[]}})};exports.getPosts=getPosts;const getSearchPosts=function(t){return __awaiter(this,arguments,void 0,function*({searchQuery:t,page:e,signal:n,providerContext:o}){try{if(e>1)return[];const i=[],s=`https://v3-cinemeta.strem.io/catalog/series/top/search=${encodeURI(t)}.json`,a=`https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI(t)}.json`,r=(yield o.axios.get(s,{headers:o.commonHeaders,signal:n})).data;null==r||r.metas.map(t=>{const e=t.name||"",n=(null==t?void 0:t.imdb_id)||(null==t?void 0:t.id),o=null==t?void 0:t.poster,s=null==t?void 0:t.type;n&&i.push({title:e,link:`https://v3-cinemeta.strem.io/meta/${s}/${n}.json`,image:o})});const l=(yield o.axios.get(a,{headers:o.commonHeaders,signal:n})).data;return null==l||l.metas.map(t=>{const e=(null==t?void 0:t.name)||"",n=(null==t?void 0:t.imdb_id)||(null==t?void 0:t.id),o=null==t?void 0:t.poster,s=null==t?void 0:t.type;n&&i.push({title:e,link:`https://v3-cinemeta.strem.io/meta/${s}/${n}.json`,image:o})}),i}catch(t){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(e,t,i,n){return new(i||(i=Promise))(function(o,r){function a(e){try{d(n.next(e))}catch(e){r(e)}}function l(e){try{d(n.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,l)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0,exports.getRiveStream=getRiveStream;const getStream=e=>__awaiter(void 0,[e],void 0,function*({link:e,type:t,providerContext:i}){try{const n=[],{imdbId:o,season:r,episode:a,title:l,tmdbId:d,year:s}=JSON.parse(e);return yield getRiveStream(d,a,r,t,n,i),n}catch(e){return[]}});function getRiveStream(e,t,i,n,o,r){return __awaiter(this,void 0,void 0,function*(){const a=generateSecretKey(Number(e)),l=yield r.getBaseUrl("rive"),d=process.env.CORS_PRXY?process.env.CORS_PRXY+"?url=":"",s="series"===n?`/api/backendfetch?requestID=tvVideoProvider&id=${e}&season=${i}&episode=${t}&secretKey=${a}&service=`:`/api/backendfetch?requestID=movieVideoProvider&id=${e}&secretKey=${a}&service=`,c=d?d+encodeURIComponent(l+s):l+s;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(e=>__awaiter(this,void 0,void 0,function*(){var t,i,n,a,l,d;try{const s=yield r.axios.get(c+e,{timeout:4e3,headers:r.commonHeaders}),u=[];(null===(i=null===(t=s.data)||void 0===t?void 0:t.data)||void 0===i?void 0:i.captions)&&(null===(a=null===(n=s.data)||void 0===n?void 0:n.data)||void 0===a||a.captions.forEach(e=>{var t,i;u.push({language:(null===(t=null==e?void 0:e.label)||void 0===t?void 0:t.slice(0,2))||"Und",uri:null==e?void 0:e.file,title:(null==e?void 0:e.label)||"Undefined",type:(null===(i=null==e?void 0:e.file)||void 0===i?void 0:i.endsWith(".vtt"))?"text/vtt":"application/x-subrip"})})),null===(d=null===(l=s.data)||void 0===l?void 0:l.data)||void 0===d||d.sources.forEach(e=>{o.push({server:(null==e?void 0:e.source)+"-"+(null==e?void 0:e.quality),link:null==e?void 0:e.url,type:"hls"===(null==e?void 0:e.format)?"m3u8":"mp4",quality:null==e?void 0:e.quality,subtitles:u})})}catch(e){}})))})}function generateSecretKey(e){const t=["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===e)return"rive";try{let i,n;const o=String(e),r=btoa(function(e){const t=String(e);let i=3735928559^t.length;for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n^=131*(e+31)&255,i=668265261*(i=(i<<7|i>>>25)>>>0^n)>>>0}return i^=i>>>16,i=2246822507*i>>>0,i^=i>>>13,i=3266489909*i>>>0,(i^=i>>>16).toString(16).padStart(8,"0")}(function(e){e=String(e);let t=0;for(let i=0;i<e.length;i++){const n=e.charCodeAt(i);t=(n+(t<<6)+(t<<16)-t^n<<i%5)>>>0}return t^=t>>>13,t=1540483477*t>>>0,(t^=t>>>15).toString(16).padStart(8,"0")}(o)));if(isNaN(Number(e))){const e=o.split("").reduce((e,t)=>e+t.charCodeAt(0),0);i=t[e%t.length]||btoa(o),n=Math.floor(e%r.length/2)}else{const a=Number(e);i=t[a%t.length]||btoa(o),n=Math.floor(a%r.length/2)}return r.slice(0,n)+i+r.slice(n)}catch(e){return"topSecret"}}exports.getStream=getStream;