Files
john-nuvio/providers/flixer.js
T
2026-07-19 20:09:25 +03:00

6 lines
12 KiB
JavaScript

/**
* 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.toString(16).padStart(2,"0");return r}function de(e){let r=atob(e),t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t}function ge(e){let r="";for(let t=0;t<e.length;){let n=e[t++],o;n<128?o=n:(n&224)===192?o=(n&31)<<6|e[t++]&63:(n&240)===224?o=(n&15)<<12|(e[t++]&63)<<6|e[t++]&63:o=(n&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63,o<=65535?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode(55296|o>>>10,56320|o&1023))}return r}function D(e,r){let t=0;for(let n=0;n<8;n++)r&1&&(t^=e),e=(e<<1^(e&128?283:0))&255,r>>>=1;return t}function me(e){if(!e)return 0;let r=1,t=e,n=254;for(;n;)n&1&&(r=D(r,t)),t=D(t,t),n>>>=1;return r}function M(e,r){return(e<<r|e>>>8-r)&255}var F=(()=>{let e=new Uint8Array(256);for(let r=0;r<256;r++){let t=me(r);e[r]=t^M(t,1)^M(t,2)^M(t,3)^M(t,4)^99}return e})();function Ce(e){if(e.length!==32)throw new Error("Invalid AES-256 key");let r=new Uint32Array(60);for(let n=0;n<8;n++){let o=n*4;r[n]=(e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])>>>0}let t=1;for(let n=8;n<r.length;n++){let o=r[n-1];n%8===0?(o=(o<<8|o>>>24)>>>0,o=(F[o>>>24]<<24|F[o>>>16&255]<<16|F[o>>>8&255]<<8|F[o&255])>>>0,o^=t<<24,t=(t<<1^(t&128?283:0))&255):n%8===4&&(o=(F[o>>>24]<<24|F[o>>>16&255]<<16|F[o>>>8&255]<<8|F[o&255])>>>0),r[n]=(r[n-8]^o)>>>0}return r}function W(e,r,t){for(let n=0;n<4;n++){let o=r[t*4+n];e[n*4]^=o>>>24,e[n*4+1]^=o>>>16&255,e[n*4+2]^=o>>>8&255,e[n*4+3]^=o&255}}function O(e,r){let t=new Uint8Array(e),n=new Uint8Array(16);W(t,r,0);for(let o=1;o<=14;o++){for(let c=0;c<16;c++)t[c]=F[t[c]];for(let c=0;c<4;c++)for(let s=0;s<4;s++)n[c+s*4]=t[c+(s+c&3)*4];if(t.set(n),o!==14)for(let c=0;c<4;c++){let s=c*4,i=t[s],a=t[s+1],h=t[s+2],l=t[s+3],A=i^a^h^l;t[s]^=A^D(i^a,2),t[s+1]^=A^D(a^h,2),t[s+2]^=A^D(h^l,2),t[s+3]^=A^D(l^i,2)}W(t,r,o)}return t}function X(e){let r=new Uint32Array(4);for(let t=0;t<4;t++){let n=t*4;r[t]=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0}return r}function we(e){let r=new Uint8Array(16);for(let t=0;t<4;t++)r[t*4]=e[t]>>>24,r[t*4+1]=e[t]>>>16&255,r[t*4+2]=e[t]>>>8&255,r[t*4+3]=e[t]&255;return r}function V(e,r){let t=new Uint32Array(4),n=new Uint32Array(r);for(let o=0;o<128;o++){if(e[o>>>5]>>>31-(o&31)&1)for(let s=0;s<4;s++)t[s]^=n[s];let c=n[3]&1;n[3]=(n[3]>>>1|(n[2]&1)<<31)>>>0,n[2]=(n[2]>>>1|(n[1]&1)<<31)>>>0,n[1]=(n[1]>>>1|(n[0]&1)<<31)>>>0,n[0]>>>=1,c&&(n[0]=(n[0]^3774873600)>>>0)}return t}function pe(e,r){let t=new Uint32Array(4);for(let i=0;i<e.length;i+=16){let a=new Uint8Array(16);a.set(e.subarray(i,Math.min(i+16,e.length)));let h=X(a);for(let l=0;l<4;l++)t[l]^=h[l];t=V(t,r)}let n=new Uint8Array(16),o=e.length*8,c=new DataView(n.buffer);c.setUint32(12,o>>>0),c.setUint32(8,Math.floor(o/4294967296));let s=X(n);for(let i=0;i<4;i++)t[i]^=s[i];return V(t,r)}function Fe(e){for(let r=15;r>=12&&(e[r]=e[r]+1&255,!e[r]);r--);}function ye(e,r){if(e.length<28)throw new Error("Invalid encrypted payload");let t=e.subarray(0,12),n=e.subarray(12,e.length-16),o=e.subarray(e.length-16),c=Ce(r),s=new Uint8Array(16),i=X(O(s,c)),a=new Uint8Array(16);a.set(t),a[15]=1;let h=we(pe(n,i)),l=O(a,c),A=0;for(let d=0;d<16;d++)A|=h[d]^l[d]^o[d];if(A)throw new Error("Invalid encrypted payload tag");let w=new Uint8Array(n.length),C=new Uint8Array(a);for(let d=0;d<n.length;d+=16){Fe(C);let f=O(C,c),u=Math.min(16,n.length-d);for(let g=0;g<u;g++)w[d+g]=n[d+g]^f[g]}return w}function Be(e,r){let t=Math.floor(r/36e5),n=new Uint8Array(16);for(let s=0;s<n.length;s++)n[s]=s+1^Math.floor(t/2**(s&7))&255;let o=Ae(v(e),n);for(let s=0;s<600;s++)o=E(o);let c=Math.floor(r/3e5);return P(o,`${c}${e}`)}function J(){return!0}function Q(){let r=`1365x768:24:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36:Linux x86_64:en-US:-180:${Math.floor(Date.now()/1e3)}:${he}`;return z(E(v(z(E(v(r))))))}function Y(e,r){let t=Be(r,Date.now());return ge(ye(de(e),t))}var Z=["alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa","quebec","romeo","sierra","tango","uniform","victor","whiskey","xray","yankee","zulu"],Ee={bravo:"Balder",delta:"Dionysus",echo:"Eros",golf:"Gaia",hotel:"Hades",india:"Isis",juliet:"Juno",kilo:"Kronos",lima:"Loki"},T={};function Ue(e,r){return m(this,null,function*(){if(/^\d+$/.test(e))return e;if(!/^tt\d+$/i.test(e))return null;let t=`${r}:${e.toLowerCase()}`;if(T[t])return T[t];let n=r==="movie"?"movie":"series";try{let o=yield _(`https://v3-cinemeta.strem.io/meta/${n}/${encodeURIComponent(e)}.json`,{headers:{Accept:"application/json"}}),c=JSON.parse(o),s=c&&c.meta&&c.meta.moviedb_id;return!s||!/^\d+$/.test(String(s))?null:(T[t]=String(s),console.log(`[Flixer] Resolved ${e} to TMDB ${s}`),T[t])}catch(o){return console.warn(`[Flixer] Could not resolve IMDb ID ${e}: ${o&&o.message?o.message:String(o)}`),null}})}function Se(e,r,t,n){return r==="movie"?`/api/tmdb/movie/${encodeURIComponent(e)}/images`:`/api/tmdb/tv/${encodeURIComponent(e)}/season/${t}/episode/${n}/images`}function ee(e,r){return m(this,null,function*(){let t=yield Y(e,r);return JSON.parse(t)})}function ve(e){let r=[];if(e&&Array.isArray(e.sources))for(let t of e.sources){let n=t&&String(t.server||"").toLowerCase();n&&!r.includes(n)&&r.push(n)}if(e&&e.servers&&typeof e.servers=="object")for(let t of Object.keys(e.servers)){let n=t.toLowerCase();r.includes(n)||r.push(n)}return Z.filter(t=>r.includes(t)).concat(r.filter(t=>!Z.includes(t)))}function De(e,r){if(e&&Array.isArray(e.sources)){let n=e.sources.find(o=>o&&String(o.server||"").toLowerCase()===r)||e.sources.find(o=>o&&o.url);return n&&typeof n.url=="string"?n.url.trim():""}if(e&&e.sources&&typeof e.sources=="object"){let t=e.sources.file||e.sources.url;return typeof t=="string"?t.trim():""}return""}function $e(e){let r=String(e).match(/(?:^|[^0-9])(2160|1440|1080|720|480|360)p?(?:[^0-9]|$)/i);return r?`${r[1]}p`:"Auto"}function be(e,r,t,n){return m(this,null,function*(){let o=yield H(t,r);return yield _(e,{headers:S(B({},o),{"X-Only-Sources":"1","X-Server":n})})})}function te(e,r,t,n){return m(this,null,function*(){let o=String(e||"").trim();if(r!=="movie"&&r!=="tv")return[];if(r==="tv"&&(!Number.isInteger(Number(t))||!Number.isInteger(Number(n))||Number(t)<1||Number(n)<1))return[];let c=yield Ue(o,r);if(!c)return[];J();let s=Q(),i=Se(c,r,Number(t),Number(n)),a=`${k}${i}`,h=yield H(s,i),l=yield _(a,{headers:S(B({},h),{bW90aGFmYWth:"1"})}),A=ve(yield ee(l,s)),w=yield Promise.all(A.map(f=>m(this,null,function*(){try{return{server:f,encrypted:yield be(a,i,s,f)}}catch(u){return console.warn(`[Flixer] ${f} request failed: ${u&&u.message?u.message:String(u)}`),{server:f,encrypted:""}}}))),C=[],d={};for(let f of w)if(f.encrypted)try{let u=De(yield ee(f.encrypted,s),f.server);if(!u||d[u])continue;d[u]=!0;let g=Ee[f.server]||f.server.charAt(0).toUpperCase()+f.server.slice(1),U=$e(u);C.push({name:`Flixer \xB7 ${g}`,title:`${g} \xB7 ${U}`,url:u,quality:U,headers:{Referer:`${$}/`,Origin:$,"User-Agent":R["User-Agent"]}})}catch(u){let g=u&&u.message?u.message:String(u);/^E5[678]$/.test(g)||console.warn(`[Flixer] ${f.server} decode failed: ${g}`)}return C})}function Re(e,r,t,n){return m(this,null,function*(){try{console.log(`[Flixer] Request: ${r} ${e}`);let o=yield te(e,r,t,n);return console.log(`[Flixer] Found ${o.length} stream(s)`),o}catch(o){return console.error(`[Flixer] Error: ${o.message}`),[]}})}module.exports={getStreams:Re};