Initial commit

This commit is contained in:
janisslsm committed 2026-07-19 20:09:25 +03:00
commit 6e86adb0e6
23 files changed
+6141

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
/**
* _template - Built from src/_template/
* Generated: 2026-07-19T17:05:24.210Z
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/_template/extractor.js
var import_cheerio_without_node_native = __toESM(require("cheerio-without-node-native"));
function extractStreams(tmdbId, mediaType, season, episode) {
return __async(this, null, function* () {
return [];
});
}
// src/_template/index.js
function getStreams(tmdbId, mediaType, season, episode) {
return __async(this, null, function* () {
try {
console.log(`[Template] Request: ${mediaType} ${tmdbId}`);
const streams = yield extractStreams(tmdbId, mediaType, season, episode);
return streams;
} catch (error) {
console.error(`[Template] Error: ${error.message}`);
return [];
}
});
}
module.exports = { getStreams };
+5
View File
@@ -0,0 +1,5 @@
/**
* flixer - Built from src/flixer/
* Generated: 2026-07-19T17:05:50.362Z
*/
var se=Object.defineProperty,ie=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var K=(e,r,t)=>r in e?se(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,B=(e,r)=>{for(var t in r||(r={}))ae.call(r,t)&&K(e,t,r[t]);if(G)for(var t of G(r))le.call(r,t)&&K(e,t,r[t]);return e},S=(e,r)=>ie(e,ce(r));var m=(e,r,t)=>new Promise((n,o)=>{var c=a=>{try{i(t.next(a))}catch(h){o(h)}},s=a=>{try{i(t.throw(a))}catch(h){o(h)}},i=a=>a.done?n(a.value):Promise.resolve(a.value).then(c,s);i((t=t.apply(e,r)).next())});var $="https://flixer.gd",k="https://plsdontscrapemelove.flixer.gd",R={Accept:"text/plain",Origin:$,Referer:`${$}/`,"User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"},b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fe=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(e){let r=[];for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319&&t+1<e.length){let o=e.charCodeAt(t+1);o>=56320&&o<=57343&&(n=65536+(n-55296<<10)+o-56320,t++)}n<128?r.push(n):n<2048?r.push(192|n>>6,128|n&63):n<65536?r.push(224|n>>12,128|n>>6&63,128|n&63):r.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63)}return new Uint8Array(r)}function p(e,r){return e>>>r|e<<32-r}function E(e){let r=e.length*8,t=Math.ceil((e.length+9)/64)*64,n=new Uint8Array(t);n.set(e),n[e.length]=128;let o=Math.floor(r/4294967296),c=r>>>0,s=t-8;n[s]=o>>>24&255,n[s+1]=o>>>16&255,n[s+2]=o>>>8&255,n[s+3]=o&255,n[s+4]=c>>>24&255,n[s+5]=c>>>16&255,n[s+6]=c>>>8&255,n[s+7]=c&255;let i=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],a=new Uint32Array(64);for(let l=0;l<n.length;l+=64){for(let x=0;x<16;x++){let y=l+x*4;a[x]=(n[y]<<24|n[y+1]<<16|n[y+2]<<8|n[y+3])>>>0}for(let x=16;x<64;x++){let y=p(a[x-15],7)^p(a[x-15],18)^a[x-15]>>>3,L=p(a[x-2],17)^p(a[x-2],19)^a[x-2]>>>10;a[x]=a[x-16]+y+a[x-7]+L>>>0}let[A,w,C,d,f,u,g,U]=i;for(let x=0;x<64;x++){let y=p(f,6)^p(f,11)^p(f,25),L=f&u^~f&g,j=U+y+L+fe[x]+a[x]>>>0,ne=p(A,2)^p(A,13)^p(A,22),re=A&w^A&C^w&C,oe=ne+re>>>0;U=g,g=u,u=f,f=d+j>>>0,d=C,C=w,w=A,A=j+oe>>>0}i[0]=i[0]+A>>>0,i[1]=i[1]+w>>>0,i[2]=i[2]+C>>>0,i[3]=i[3]+d>>>0,i[4]=i[4]+f>>>0,i[5]=i[5]+u>>>0,i[6]=i[6]+g>>>0,i[7]=i[7]+U>>>0}let h=new Uint8Array(32);for(let l=0;l<i.length;l++)h[l*4]=i[l]>>>24&255,h[l*4+1]=i[l]>>>16&255,h[l*4+2]=i[l]>>>8&255,h[l*4+3]=i[l]&255;return h}function P(e,r){let t=e instanceof Uint8Array?e:v(String(e));t.length>64&&(t=E(t));let n=r instanceof Uint8Array?r:v(String(r)),o=new Uint8Array(64+n.length),c=new Uint8Array(96);for(let s=0;s<64;s++){let i=s<t.length?t[s]:0;o[s]=i^54,c[s]=i^92}return o.set(n,64),c.set(E(o),64),E(c)}function q(e){let r="";for(let t=0;t<e.length;t+=3){let n=t+1<e.length,o=t+2<e.length,c=e[t]<<16|(n?e[t+1]:0)<<8|(o?e[t+2]:0);r+=b[c>>>18&63],r+=b[c>>>12&63],r+=n?b[c>>>6&63]:"=",r+=o?b[c&63]:"="}return r}function ue(){let e=new Uint8Array(16);for(let r=0;r<e.length;r++)e[r]=Math.floor(Math.random()*256);return q(e).replace(/[/+=]/g,"").slice(0,22)}var N=0,I=0;function xe(){return m(this,null,function*(){let e=Date.now();if(I&&e-I<3e5)return Math.floor((e+N)/1e3);try{let r=Date.now(),t=yield fetch(`${k}/api/time?t=${r}`,{headers:S(B({},R),{"Cache-Control":"no-cache"})});if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=yield t.json();if(!n||typeof n.timestamp!="number")throw new Error("invalid response");let o=Date.now();return N=n.timestamp*1e3+(o-r)/2-o,I=o,Math.floor((o+N)/1e3)}catch(r){return Math.floor(Date.now()/1e3)}})}function H(e,r){return m(this,null,function*(){let t=yield xe(),n=ue(),o=`${e}:${t}:${n}:${r}`;return{"X-Api-Key":e,"X-Request-Timestamp":String(t),"X-Request-Nonce":n,"X-Request-Signature":q(P(e,o)),"X-Client-Fingerprint":"zerlgt","X-Fingerprint-Lite":"e9136c41504646444"}})}function _(t){return m(this,arguments,function*(e,r={}){let n=yield fetch(e,S(B({},r),{headers:B(B({},R),r.headers||{})}));if(!n.ok)throw new Error(`HTTP ${n.status} for ${e}`);return yield n.text()})}var he="iVBORw0KGgoAAAANSUhEUgAAAMgAAAAyCAYAAAAZUZThAAAQAE";function Ae(...e){let r=0;for(let o of e)r+=o.length;let t=new Uint8Array(r),n=0;for(let o of e)t.set(o,n),n+=o.length;return t}function z(e){let r="";for(let t of e)r+=t.Line truncated
+867
View File
@@ -0,0 +1,867 @@
/**
* miruro - Built from src/miruro/
* Generated: 2026-07-19T17:01:21.823Z
*/
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// node_modules/fflate/esm/browser.js
var u8 = Uint8Array;
var u16 = Uint16Array;
var i32 = Int32Array;
var fleb = new u8([
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
2,
2,
2,
2,
3,
3,
3,
3,
4,
4,
4,
4,
5,
5,
5,
5,
0,
/* unused */
0,
0,
/* impossible */
0
]);
var fdeb = new u8([
0,
0,
0,
0,
1,
1,
2,
2,
3,
3,
4,
4,
5,
5,
6,
6,
7,
7,
8,
8,
9,
9,
10,
10,
11,
11,
12,
12,
13,
13,
/* unused */
0,
0
]);
var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
var freb = function(eb, start) {
var b = new u16(31);
for (var i = 0; i < 31; ++i) {
b[i] = start += 1 << eb[i - 1];
}
var r = new i32(b[30]);
for (var i = 1; i < 30; ++i) {
for (var j = b[i]; j < b[i + 1]; ++j) {
r[j] = j - b[i] << 5 | i;
}
}
return { b, r };
};
var _a = freb(fleb, 2);
var fl = _a.b;
var revfl = _a.r;
fl[28] = 258, revfl[258] = 28;
var _b = freb(fdeb, 0);
var fd = _b.b;
var revfd = _b.r;
var rev = new u16(32768);
for (i = 0; i < 32768; ++i) {
x = (i & 43690) >> 1 | (i & 21845) << 1;
x = (x & 52428) >> 2 | (x & 13107) << 2;
x = (x & 61680) >> 4 | (x & 3855) << 4;
rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
}
var x;
var i;
var hMap = function(cd, mb, r) {
var s = cd.length;
var i = 0;
var l = new u16(mb);
for (; i < s; ++i) {
if (cd[i])
++l[cd[i] - 1];
}
var le = new u16(mb);
for (i = 1; i < mb; ++i) {
le[i] = le[i - 1] + l[i - 1] << 1;
}
var co;
if (r) {
co = new u16(1 << mb);
var rvb = 15 - mb;
for (i = 0; i < s; ++i) {
if (cd[i]) {
var sv = i << 4 | cd[i];
var r_1 = mb - cd[i];
var v = le[cd[i] - 1]++ << r_1;
for (var m = v | (1 << r_1) - 1; v <= m; ++v) {
co[rev[v] >> rvb] = sv;
}
}
}
} else {
co = new u16(s);
for (i = 0; i < s; ++i) {
if (cd[i]) {
co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
}
}
}
return co;
};
var flt = new u8(288);
for (i = 0; i < 144; ++i)
flt[i] = 8;
var i;
for (i = 144; i < 256; ++i)
flt[i] = 9;
var i;
for (i = 256; i < 280; ++i)
flt[i] = 7;
var i;
for (i = 280; i < 288; ++i)
flt[i] = 8;
var i;
var fdt = new u8(32);
for (i = 0; i < 32; ++i)
fdt[i] = 5;
var i;
var flrm = /* @__PURE__ */ hMap(flt, 9, 1);
var fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
var max = function(a) {
var m = a[0];
for (var i = 1; i < a.length; ++i) {
if (a[i] > m)
m = a[i];
}
return m;
};
var bits = function(d, p, m) {
var o = p / 8 | 0;
return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
};
var bits16 = function(d, p) {
var o = p / 8 | 0;
return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
};
var shft = function(p) {
return (p + 7) / 8 | 0;
};
var slc = function(v, s, e) {
if (s == null || s < 0)
s = 0;
if (e == null || e > v.length)
e = v.length;
return new u8(v.subarray(s, e));
};
var ec = [
"unexpected EOF",
"invalid block type",
"invalid length/literal",
"invalid distance",
"stream finished",
"no stream handler",
,
// determined by compression function
"no callback",
"invalid UTF-8 data",
"extra field too long",
"date not in range 1980-2099",
"filename too long",
"stream finishing",
"invalid zip data"
// determined by unknown compression method
];
var err = function(ind, msg, nt) {
var e = new Error(msg || ec[ind]);
e.code = ind;
if (Error.captureStackTrace)
Error.captureStackTrace(e, err);
if (!nt)
throw e;
return e;
};
var inflt = function(dat, st, buf, dict) {
var sl = dat.length, dl = dict ? dict.length : 0;
if (!sl || st.f && !st.l)
return buf || new u8(0);
var noBuf = !buf;
var resize = noBuf || st.i != 2;
var noSt = st.i;
if (noBuf)
buf = new u8(sl * 3);
var cbuf = function(l2) {
var bl = buf.length;
if (l2 > bl) {
var nbuf = new u8(Math.max(bl * 2, l2));
nbuf.set(buf);
buf = nbuf;
}
};
var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
var tbts = sl * 8;
do {
if (!lm) {
final = bits(dat, pos, 1);
var type = bits(dat, pos + 1, 3);
pos += 3;
if (!type) {
var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
if (t > sl) {
if (noSt)
err(0);
break;
}
if (resize)
cbuf(bt + l);
buf.set(dat.subarray(s, t), bt);
st.b = bt += l, st.p = pos = t * 8, st.f = final;
continue;
} else if (type == 1)
lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
else if (type == 2) {
var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
var tl = hLit + bits(dat, pos + 5, 31) + 1;
pos += 14;
var ldt = new u8(tl);
var clt = new u8(19);
for (var i = 0; i < hcLen; ++i) {
clt[clim[i]] = bits(dat, pos + i * 3, 7);
}
pos += hcLen * 3;
var clb = max(clt), clbmsk = (1 << clb) - 1;
var clm = hMap(clt, clb, 1);
for (var i = 0; i < tl; ) {
var r = clm[bits(dat, pos, clbmsk)];
pos += r & 15;
var s = r >> 4;
if (s < 16) {
ldt[i++] = s;
} else {
var c = 0, n = 0;
if (s == 16)
n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
else if (s == 17)
n = 3 + bits(dat, pos, 7), pos += 3;
else if (s == 18)
n = 11 + bits(dat, pos, 127), pos += 7;
while (n--)
ldt[i++] = c;
}
}
var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
lbt = max(lt);
dbt = max(dt);
lm = hMap(lt, lbt, 1);
dm = hMap(dt, dbt, 1);
} else
err(1);
if (pos > tbts) {
if (noSt)
err(0);
break;
}
}
if (resize)
cbuf(bt + 131072);
var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
var lpos = pos;
for (; ; lpos = pos) {
var c = lm[bits16(dat, pos) & lms], sym = c >> 4;
pos += c & 15;
if (pos > tbts) {
if (noSt)
err(0);
break;
}
if (!c)
err(2);
if (sym < 256)
buf[bt++] = sym;
else if (sym == 256) {
lpos = pos, lm = null;
break;
} else {
var add = sym - 254;
if (sym > 264) {
var i = sym - 257, b = fleb[i];
add = bits(dat, pos, (1 << b) - 1) + fl[i];
pos += b;
}
var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
if (!d)
err(3);
pos += d & 15;
var dt = fd[dsym];
if (dsym > 3) {
var b = fdeb[dsym];
dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
}
if (pos > tbts) {
if (noSt)
err(0);
break;
}
if (resize)
cbuf(bt + 131072);
var end = bt + add;
if (bt < dt) {
var shift = dl - dt, dend = Math.min(dt, end);
if (shift + bt < 0)
err(3);
for (; bt < dend; ++bt)
buf[bt] = dict[shift + bt];
}
for (; bt < end; ++bt)
buf[bt] = buf[bt - dt];
}
}
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
if (lm)
final = 1, st.m = lbt, st.d = dm, st.n = dbt;
} while (!final);
return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
};
var et = /* @__PURE__ */ new u8(0);
var gzs = function(d) {
if (d[0] != 31 || d[1] != 139 || d[2] != 8)
err(6, "invalid gzip data");
var flg = d[3];
var st = 10;
if (flg & 4)
st += (d[10] | d[11] << 8) + 2;
for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])
;
return st + (flg & 2);
};
var gzl = function(d) {
var l = d.length;
return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;
};
function gunzipSync(data, opts) {
var st = gzs(data);
if (st + 8 > data.length)
err(6, "invalid gzip data");
return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);
}
var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder();
var tds = 0;
try {
td.decode(et, { stream: true });
tds = 1;
} catch (e) {
}
var dutf8 = function(d) {
for (var r = "", i = 0; ; ) {
var c = d[i++];
var eb = (c > 127) + (c > 223) + (c > 239);
if (i + eb > d.length)
return { s: r, r: slc(d, i - 1) };
if (!eb)
r += String.fromCharCode(c);
else if (eb == 3) {
c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
} else if (eb & 1)
r += String.fromCharCode((c & 31) << 6 | d[i++] & 63);
else
r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63);
}
};
function strFromU8(dat, latin1) {
if (latin1) {
var r = "";
for (var i = 0; i < dat.length; i += 16384)
r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));
return r;
} else if (td) {
return td.decode(dat);
} else {
var _a2 = dutf8(dat), s = _a2.s, r = _a2.r;
if (r.length)
err(8);
return s;
}
}
// src/miruro/http.js
var BASE_URL = "https://www.miruro.to";
var HEADERS = {
"Accept": "*/*",
"Referer": `${BASE_URL}/`,
"User-Agent": "Mozilla/5.0 (Linux; Android 15) AppleWebKit/537.36 Chrome/140.0.0.0 Mobile Safari/537.36",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin"
};
var PIPE_OBFUSCATION_KEY = hexToBytes("71951034f8fbcf53d89db52ceb3dc22c");
var BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function hexToBytes(value) {
const bytes = new Uint8Array(value.length / 2);
for (let index = 0; index < bytes.length; index++) {
bytes[index] = parseInt(value.slice(index * 2, index * 2 + 2), 16);
}
return bytes;
}
function encodeBase64Url(value) {
let result = "";
for (let index = 0; index < value.length; index += 3) {
const first = value.charCodeAt(index);
const hasSecond = index + 1 < value.length;
const hasThird = index + 2 < value.length;
const second = hasSecond ? value.charCodeAt(index + 1) : 0;
const third = hasThird ? value.charCodeAt(index + 2) : 0;
const chunk = first << 16 | second << 8 | third;
result += BASE64_ALPHABET[chunk >> 18 & 63];
result += BASE64_ALPHABET[chunk >> 12 & 63];
result += hasSecond ? BASE64_ALPHABET[chunk >> 6 & 63] : "=";
result += hasThird ? BASE64_ALPHABET[chunk & 63] : "=";
}
return result.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
}
function decodeBase64Url(value) {
const normalized = value.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
const outputLength = Math.floor(normalized.length * 6 / 8);
const output = new Uint8Array(outputLength);
let buffer = 0;
let bits2 = 0;
let outputIndex = 0;
for (let index = 0; index < normalized.length; index++) {
const code = BASE64_ALPHABET.indexOf(normalized[index]);
if (code < 0) {
continue;
}
buffer = buffer << 6 | code;
bits2 += 6;
if (bits2 >= 8) {
bits2 -= 8;
output[outputIndex++] = buffer >> bits2 & 255;
}
}
return outputIndex === output.length ? output : output.slice(0, outputIndex);
}
function decodeSecurePayload(raw, obfuscationVersion) {
if (!obfuscationVersion) {
return JSON.parse(raw);
}
const bytes = decodeBase64Url(raw);
if (obfuscationVersion === "2") {
for (let index = 0; index < bytes.length; index++) {
bytes[index] ^= PIPE_OBFUSCATION_KEY[index % PIPE_OBFUSCATION_KEY.length];
}
}
return JSON.parse(strFromU8(gunzipSync(bytes)));
}
function mergeHeaders(headers) {
return __spreadValues(__spreadValues({}, HEADERS), headers || {});
}
function fetchText(_0) {
return __async(this, arguments, function* (url, options = {}) {
const response = yield fetch(url, __spreadProps(__spreadValues({}, options), {
headers: mergeHeaders(options.headers)
}));
if (!response.ok) {
throw new Error(`HTTP ${response.status} for ${url}`);
}
return yield response.text();
});
}
function fetchJson(_0) {
return __async(this, arguments, function* (url, options = {}) {
const raw = yield fetchText(url, options);
return JSON.parse(raw);
});
}
function secureGet(_0) {
return __async(this, arguments, function* (path, query = {}) {
const envelope = encodeBase64Url(JSON.stringify({
path,
method: "GET",
query,
body: null
}));
const url = `${BASE_URL}/api/secure/pipe?e=${envelope}`;
let response;
for (let attempt = 0; attempt < 2; attempt++) {
response = yield fetch(url, { headers: HEADERS });
if (response.ok || response.status !== 403 && response.status !== 429 && response.status < 500) {
break;
}
}
if (!response || !response.ok) {
throw new Error(`Miruro API returned HTTP ${response ? response.status : "unknown"}`);
}
const raw = yield response.text();
const version = response.headers && response.headers.get ? response.headers.get("x-obfuscated") : null;
return decodeSecurePayload(raw.trim(), version);
});
}
// src/miruro/extractor.js
var ANIMAP_URL = "https://animap.id/api/map";
var ANILIST_URL = "https://graphql.anilist.co";
var PROVIDERS = [
{ id: "bonk", label: "Bonk", subCategory: "ssub" },
{ id: "kiwi", label: "Kiwi", subCategory: "sub" },
{ id: "hop", label: "Hop", subCategory: "ssub" },
{ id: "ally", label: "Ally", subCategory: "sub" },
{ id: "pewe", label: "Pewe", subCategory: "sub" },
{ id: "bee", label: "Bee", subCategory: "ssub" },
{ id: "moo", label: "Moo", subCategory: "sub" }
];
function asNumber(value) {
const number = Number(value);
return Number.isFinite(number) ? number : null;
}
function parseIdentifier(value) {
const id = String(value || "").trim();
if (/^tt\d+$/i.test(id)) {
return { service: "imdb", value: id.toLowerCase() };
}
if (/^\d+$/.test(id)) {
return { service: "tmdb", value: id };
}
return null;
}
function recordMatchesIdentifier(record, identifier, mediaType) {
const expectedType = mediaType === "movie" ? "movie" : "tv";
if (identifier.service === "imdb") {
const imdbMatches = (record.imdb_id || []).some((id) => String(id).toLowerCase() === identifier.value);
const typeMatches = (record.tmdb_id || []).length === 0 || (record.tmdb_id || []).some((mapping) => mapping.type === expectedType);
return imdbMatches && typeMatches;
}
return (record.tmdb_id || []).some((mapping) => String(mapping.id) === identifier.value && mapping.type === expectedType);
}
function getAniListIds(records, identifier, mediaType) {
const ids = [];
for (const record of Array.isArray(records) ? records : []) {
if (!recordMatchesIdentifier(record, identifier, mediaType)) {
continue;
}
for (const id of record.anilist_id || []) {
const numericId = asNumber(id);
if (numericId && !ids.includes(numericId)) {
ids.push(numericId);
}
}
}
return ids;
}
function getLocalEpisode(mappings, mediaType, season, episode) {
if (!mappings) {
return null;
}
if (mediaType === "movie") {
return 1;
}
const requestedSeason = asNumber(season) || 1;
const requestedEpisode = asNumber(episode);
if (!requestedEpisode || requestedEpisode < 1) {
return null;
}
const mappedSeason = mappings.tmdbSeason || mappings.defaultTvdbSeason;
if (mappedSeason === "absolute") {
return requestedSeason === 1 ? requestedEpisode : null;
}
if (mappedSeason != null && String(mappedSeason) !== String(requestedSeason)) {
return null;
}
const offset = asNumber(mappings.tmdbOffset) || asNumber(mappings.episodeOffset) || 0;
const episodeCount = asNumber(mappings.episodes);
if (requestedEpisode <= offset || episodeCount && requestedEpisode > offset + episodeCount) {
return null;
}
return requestedEpisode - offset;
}
function getAniListSequel(anilistId) {
return __async(this, null, function* () {
const response = yield fetchJson(ANILIST_URL, {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
query: `
query ($id: Int!) {
Media(id: $id, type: ANIME) {
relations {
edges {
relationType
node {
id
type
format
}
}
}
}
}
`,
variables: { id: anilistId }
})
});
const edges = response && response.data && response.data.Media && response.data.Media.relations ? response.data.Media.relations.edges : [];
const sequel = (edges || []).find((edge) => edge.relationType === "SEQUEL" && edge.node && edge.node.type === "ANIME" && ["TV", "TV_SHORT", "ONA"].includes(edge.node.format));
return sequel ? asNumber(sequel.node.id) : null;
});
}
function getSeasonAniListId(anilistId, season) {
return __async(this, null, function* () {
const requestedSeason = asNumber(season) || 1;
let currentId = anilistId;
for (let currentSeason = 1; currentSeason < requestedSeason; currentSeason++) {
const sequelId = yield getAniListSequel(currentId);
if (!sequelId || sequelId === currentId) {
return null;
}
currentId = sequelId;
}
return currentId;
});
}
function getSequelEpisode(payload, mediaType, season, episode) {
return getLocalEpisode(payload.mappings, mediaType, season, episode) || getLocalEpisode(payload.mappings, mediaType, 1, episode);
}
function resolveEpisodePayload(mediaId, mediaType, season, episode) {
return __async(this, null, function* () {
const identifier = parseIdentifier(mediaId);
if (!identifier) {
return null;
}
let mappingRecords;
try {
mappingRecords = yield fetchJson(
`${ANIMAP_URL}/${identifier.service}/${encodeURIComponent(identifier.value)}`,
{ headers: { "Accept": "application/json" } }
);
} catch (error) {
console.warn(`[Miruro] No anime mapping for ${mediaId}: ${error.message}`);
return null;
}
const aniListIds = getAniListIds(mappingRecords, identifier, mediaType);
if (aniListIds.length === 0) {
return null;
}
if (aniListIds.length === 1) {
const anilistId = aniListIds[0];
if (mediaType === "tv" && (asNumber(season) || 1) > 1) {
try {
const seasonAniListId = yield getSeasonAniListId(anilistId, season);
if (seasonAniListId && seasonAniListId !== anilistId) {
const payload2 = yield secureGet("episodes", { anilistId: seasonAniListId });
const localEpisode2 = getSequelEpisode(payload2, mediaType, season, episode);
if (localEpisode2) {
return { anilistId: seasonAniListId, localEpisode: localEpisode2, payload: payload2 };
}
}
} catch (error) {
console.warn(`[Miruro] Season ${season} mapping fallback failed: ${error.message}`);
}
}
const payload = yield secureGet("episodes", { anilistId });
const localEpisode = getLocalEpisode(payload.mappings, mediaType, season, episode);
return localEpisode ? { anilistId, localEpisode, payload } : null;
}
for (const anilistId of aniListIds) {
try {
const info = yield secureGet(`info/${anilistId}`);
const localEpisode = getLocalEpisode(info.mappings, mediaType, season, episode);
if (localEpisode) {
const payload = yield secureGet("episodes", { anilistId });
return { anilistId, localEpisode, payload };
}
} catch (error) {
console.warn(`[Miruro] Skipping AniList ${anilistId}: ${error.message}`);
}
}
return null;
});
}
function findEpisode(providerPayload, variant, episodeNumber) {
const episodes = providerPayload && providerPayload.episodes ? providerPayload.episodes[variant] : null;
if (!Array.isArray(episodes)) {
return null;
}
return episodes.find((item) => Number(item.number) === Number(episodeNumber)) || null;
}
function getOrigin(url) {
const match = typeof url === "string" ? url.match(/^(https?:\/\/[^/]+)/i) : null;
return match ? match[1] : BASE_URL;
}
function getQuality(stream) {
const value = String(stream.quality || stream.server || "HD");
const resolution = value.match(/(2160|1440|1080|720|480|360)p?/i);
if (resolution) {
return `${resolution[1]}p`;
}
return /4k/i.test(value) ? "4K" : "HD";
}
function isPlayableStream(stream) {
const type = String(stream && stream.type || "").toLowerCase();
return !!(stream && stream.url) && (type === "hls" || type === "m3u8" || type === "mp4" || type === "application/x-mpegurl");
}
function normalizeStreams(sourcePayload, provider, variant) {
const subtitleCount = Array.isArray(sourcePayload.subtitles) ? sourcePayload.subtitles.length : 0;
const language = variant === "dub" ? "DUB" : "SUB";
return (sourcePayload.streams || []).filter(isPlayableStream).map((stream) => {
const referer = stream.referer || BASE_URL;
const server = stream.server || getQuality(stream);
const subtitleLabel = subtitleCount > 0 && variant !== "dub" ? " \xB7 CC" : "";
return {
// Nuvio's source picker prominently displays `name`, so include the
// Miruro server and audio variant here instead of only in `title`.
name: `Miruro \xB7 ${provider.label} \xB7 ${language}`,
title: `[${language}] ${provider.label} \xB7 ${server}${subtitleLabel}`,
url: stream.url,
quality: getQuality(stream),
headers: {
"Referer": referer,
"Origin": getOrigin(referer),
"User-Agent": HEADERS["User-Agent"]
}
};
});
}
function getProviderStreams(provider, providerPayload, anilistId, episodeNumber) {
return __async(this, null, function* () {
const requests = [];
const subEpisode = findEpisode(providerPayload, "sub", episodeNumber);
const dubEpisode = findEpisode(providerPayload, "dub", episodeNumber);
if (subEpisode) {
requests.push({ episode: subEpisode, variant: "sub", category: provider.subCategory });
}
if (dubEpisode) {
requests.push({ episode: dubEpisode, variant: "dub", category: "dub" });
}
const results = yield Promise.all(requests.map((request) => __async(this, null, function* () {
try {
const sources = yield secureGet("sources", {
episodeId: request.episode.id,
provider: provider.id,
category: request.category,
anilistId
});
return normalizeStreams(sources, provider, request.variant);
} catch (error) {
console.warn(`[Miruro] ${provider.label} ${request.variant} failed: ${error.message}`);
return [];
}
})));
return results.flat();
});
}
function extractStreams(tmdbId, mediaType, season, episode) {
return __async(this, null, function* () {
if (!tmdbId || mediaType !== "movie" && mediaType !== "tv") {
return [];
}
const resolved = yield resolveEpisodePayload(tmdbId, mediaType, season, episode);
if (!resolved || !resolved.payload || !resolved.payload.providers) {
return [];
}
const providerResults = yield Promise.all(PROVIDERS.map((provider) => {
const payload = resolved.payload.providers[provider.id];
return payload ? getProviderStreams(provider, payload, resolved.anilistId, resolved.localEpisode) : [];
}));
const streams = providerResults.flat();
const seen = /* @__PURE__ */ new Set();
return streams.filter((stream) => {
if (seen.has(stream.url)) {
return false;
}
seen.add(stream.url);
return true;
});
});
}
// src/miruro/index.js
function getStreams(tmdbId, mediaType, season, episode) {
return __async(this, null, function* () {
try {
const episodeLabel = mediaType === "tv" ? ` S${season}E${episode}` : "";
console.log(`[Miruro] Request: ${mediaType} ${tmdbId}${episodeLabel}`);
const streams = yield extractStreams(tmdbId, mediaType, season, episode);
console.log(`[Miruro] Found ${streams.length} stream(s)`);
return streams;
} catch (error) {
console.error(`[Miruro] Error: ${error.message}`);
return [];
}
});
}
module.exports = { getStreams };