@letsmoe/otter-plugin-s-to 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -3
- package/plugin.js +4 -0
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letsmoe/otter-plugin-s-to",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "plugin.js",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"otter-plugin"
|
|
7
|
+
],
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Letsmoe/otter.git"
|
|
11
|
+
}
|
|
6
12
|
}
|
package/plugin.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var y={"User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"de-DE,de;q=0.9,en;q=0.8","Accept-Encoding":"gzip, deflate, br"};function $j(){let j=process.env.FLARESOLVERR_URL;return j&&j.trim()?j.trim():void 0}function Zj(){return $j()!==void 0}async function zj(j,$=60000){let Z=$j();if(!Z)throw Error("no FLARESOLVERR_URL configured");let z=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cmd:"request.get",url:j,maxTimeout:$}),signal:AbortSignal.timeout($+5000)});if(!z.ok)throw Error(`solver HTTP ${z.status} fetching ${j}`);let J=await z.json();if(J.status!=="ok"||!J.solution?.response)throw Error(`solver failed for ${j}: ${J.message??"unknown"}`);return J.solution.response}function v(j){try{return new URL(j).hostname.replace(/^www\./,"")}catch{return""}}function b(j){return j}var t=require("fs");class K extends Error{type;code;status;constructor(j,$,Z={}){super($);this.name=j,this.type=j,this.code=Z.code,this.status=Z.status}}class P extends K{constructor(j,$){super("blocked_error",j,{code:"blocked",status:$})}}class W extends K{constructor(j,$,Z){super("source_error",$,{code:j,status:Z})}}class I extends K{constructor(j,$){super("dead_link_error",j,{code:"dead_link",status:$})}}class f extends K{constructor(j,$){super("rate_limit_error",j,{code:"rate_limited",status:$})}}class B extends K{constructor(j,$){super("http_error",j,{status:$})}}var h=require("node-html-parser");var V0=/eval\(function\(p,a,c,k,e,[dr]\)/,Y0=/\}\(['"]/,W0=/^,\s*(\d+)\s*,\s*(\d+)\s*,\s*(?=['"])/,G0=/^\s*\.split\(\s*['"]\|['"]\s*\)/;var M0={n:`
|
|
2
|
+
`,t:"\t",r:"\r"};function Jj(j,$){let Z=j[$],z="",J=$+1;while(J<j.length){let Q=j[J];if(Q===Z)return{value:z,end:J+1};if(Q!=="\\"){z+=Q,J+=1;continue}let X=j[J+1];z+=M0[X]||X,J+=2}return}function Xj(j,$){let Z=j%$,z=j<$?"":Xj(Math.floor(j/$),$);if(Z>35)return z+String.fromCharCode(Z+29);return z+Z.toString(36)}function q0(j,$,Z){let z=new Map;for(let J=0;J<Z;J++){let Q=Xj(J,$);z.set(Q,j[J]||Q)}return z}function C0(j){let $=V0.exec(j);if(!$)return;let Z=j.slice($.index).search(Y0);if(Z===-1)return;let z=Jj(j,$.index+Z+2);if(!z)return;let J=j.slice(z.end),Q=W0.exec(J);if(!Q)return;let X=Jj(J,Q[0].length);if(!X)return;if(!G0.test(J.slice(X.end)))return;return{payload:z.value,radix:parseInt(Q[1],10),count:parseInt(Q[2],10),words:X.value.split("|")}}function Qj(j){let $=C0(j);if(!$)return;let Z=q0($.words,$.radix,$.count);return $.payload.replace(/\b\w+\b/g,(z)=>{let J=Z.get(z);if(J===void 0)return z;return J})}function x(j){let $=Qj(j);if($===void 0)return;for(let Z=1;Z<3;Z++){let z=Qj($);if(z===void 0)return $;$=z}return $}var D0=/^[a-z][a-z0-9+.-]*:/i,H0=/^([a-z][a-z0-9+.-]*:)\/\/([^/?#]+)([^?#]*)(\?[^#]*)?/i;function Yj(j){let $=H0.exec(j);if(!$)throw Error(`not an absolute URL: ${j}`);return{protocol:$[1],origin:`${$[1]}//${$[2]}`,pathname:$[3]||"/",search:$[4]||""}}function G(j){return Yj(j).origin}function Vj(j){let $=j.search(/[?#]/),Z=j,z="";if($!==-1)Z=j.slice(0,$),z=j.slice($);let J=[];for(let X of Z.split("/"))if(X==="..")J.pop();else if(X!==".")J.push(X);let Q=J.join("/");if(Q.startsWith("/"))return Q+z;return"/"+Q+z}function C(j,$){if(D0.test($))return $;let Z=Yj(j);if($.startsWith("//"))return Z.protocol+$;if($.startsWith("/"))return Z.origin+Vj($);if($.startsWith("?"))return Z.origin+Z.pathname+$;if($.startsWith("#"))return Z.origin+Z.pathname+Z.search+$;let z=Z.pathname.slice(0,Z.pathname.lastIndexOf("/")+1);return Z.origin+Vj(z+$)}var K0=/https?:\/\/[^\s"'<>\\)]+/gi,N0=/\.(m3u8|mpd|mp4|webm)(?:[?#]|$)/i;function L(j,$="video/mp4"){if(/\.m3u8/i.test(j))return"application/x-mpegURL";if(/\.mpd/i.test(j))return"application/dash+xml";if(/\.webm/i.test(j))return"video/webm";if(/\.mp4/i.test(j))return"video/mp4";return $}function I0(j){return j.replace(/\\\//g,"/").replace(/\\u0026/gi,"&").replace(/&/g,"&")}function Wj(j){let $=I0(j).match(K0)||[],Z=[];for(let z of $){let J=z.replace(/[,;]+$/,"");if(N0.test(J))Z.push(J)}return Z}function B0(j){let $=x(j),Z=Wj(j);if($!==void 0)Z.push(...Wj($));return[...new Set(Z)].map((J)=>({url:J,mime_type:L(J)}))}function F0(j,$){if(!j||/^(javascript|about|data):/i.test(j))return;try{return C($,j)}catch{return}}function _0(j,$){let Z=[];for(let z of h.parse(j).querySelectorAll("iframe")){let J=z.getAttribute("src")||z.getAttribute("data-src")||"",Q=F0(J,$);if(Q)Z.push(Q)}return Z}function w0(j){return j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L0(j,$){let Z=j[$],z=Z==="{"?"}":"]",J=0,Q=!1;for(let X=$;X<j.length;X++){let V=j[X];if(Q){if(V==="\\")X+=1;else if(V==='"')Q=!1;continue}if(V==='"')Q=!0;else if(V===Z)J+=1;else if(V===z)J-=1;if(J===0)return j.slice($,X+1)}return}function Gj(j){if(j===void 0)return;try{return JSON.parse(j)}catch{return}}function O0(j,$){let Z=h.parse(j).querySelector(`script[id="${$}"]`);if(!Z)return;return Gj(Z.textContent)}function v0(j,$){let Z=O0(j,$);if(Z!==void 0)return Z;let J=new RegExp(`${w0($)}["']?\\s*[:=]\\s*([\\[{])`).exec(j);if(!J)return;let Q=J.index+J[0].length-1;return Gj(L0(j,Q))}function F(j){let $=j.replace(/\s+/g,"").replace(/-/g,"+").replace(/_/g,"/"),Z=(4-$.length%4)%4;return Buffer.from($+"=".repeat(Z),"base64").toString("utf-8")}var c={mediaUrls:B0,unpack:x,iframes:_0,scriptJson:v0,base64:F,mimeType:L};var qj=require("node-html-parser");var P0=15000,A0=2,U0=250,S0=["cf-chl-","_cf_chl_opt","challenge-platform","cf-browser-verification","challenges.cloudflare.com","attention required! | cloudflare"];class A{rawResponse;bodyText;constructor(j,$){this.rawResponse=j;this.bodyText=$}get status(){return this.rawResponse.status}get url(){return this.rawResponse.url}async text(){if(this.bodyText===void 0)this.bodyText=await this.rawResponse.text();return this.bodyText}async json(){return JSON.parse(await this.text())}async html(){return qj.parse(await this.text())}response(){return this.rawResponse}}function R0(j){if(!j||j.length===0)return"en-US,en;q=0.9";let Z=j[0];if(Z==="en")return"en-US,en;q=0.9";let z=Z.split("-")[0];if(Z===z)return`${Z}-${Z.toUpperCase()},${Z};q=0.9,en;q=0.8`;return`${Z},${z};q=0.9,en;q=0.8`}function Mj(j,$,Z){if(j!==403&&j!==503)return!1;if($.get("cf-mitigated")==="challenge")return!0;let z=Z.toLowerCase();if(z.includes("just a moment")&&z.includes("cloudflare"))return!0;return S0.some((J)=>z.includes(J))}function g(j,$){let Z=`HTTP ${$} fetching ${j}`;if($===429)return new f(Z,$);if($>=500)return new W("source_offline",Z,$);return new B(Z,$)}function k0(j){return new Promise(($)=>setTimeout($,j))}function T0(j){return new URLSearchParams(j).toString()}function Cj(j){return new Dj(j)}class Dj{config;fetchImplementation;constructor(j){this.config=j;this.fetchImplementation=j.fetch??fetch}get(j,$={}){return this.send(this.prepare("GET",j,$))}post(j,$={}){let Z=this.prepare("POST",j,$);return this.attachBody(Z.init,$),this.send(Z)}async finalUrl(j,$={}){let Z=this.prepare("GET",j,$);try{return(await this.fetchImplementation(Z.url,this.withTimeout(Z))).url||Z.url}catch{return Z.url}}absolute(j){if(/^https?:\/\//i.test(j))return j;if(j.startsWith("//"))return"https:"+j;if(!this.config.baseUrl)throw Error(`cannot resolve "${j}": the plugin declares no base_url`);return C(this.config.baseUrl+"/",j)}prepare(j,$,Z){let z={"User-Agent":y["User-Agent"],Accept:y.Accept,"Accept-Language":R0(this.config.languages)};if(Z.referer)z.Referer=Z.referer;Object.assign(z,Z.headers);let J=A0;if(Z.retries!==void 0)J=Z.retries;let Q={method:j,headers:z};if(Z.follow_redirects===!1)Q.redirect="manual";return{url:this.absolute($),init:Q,retries:J,timeoutMs:Z.timeout_ms||P0,allowErrorStatus:Z.allow_error_status===!0}}withTimeout(j){return{...j.init,signal:AbortSignal.timeout(j.timeoutMs)}}attachBody(j,$){let Z=j.headers;if($.json!==void 0){Z["Content-Type"]="application/json",j.body=JSON.stringify($.json);return}if(typeof $.body==="string"){j.body=$.body;return}if($.body)Z["Content-Type"]="application/x-www-form-urlencoded",j.body=T0($.body)}async send(j){let $=await this.fetchWithRetries(j),Z=$.response.status;if(Z>=200&&Z<400)return new A($.response,$.bodyText);let z=await this.readBody($);if(Mj(Z,$.response.headers,z))return this.solveChallenge(j,$.response);if(j.allowErrorStatus)return new A($.response,z);throw g(j.url,Z)}async readBody(j){if(j.bodyText!==void 0)return j.bodyText;return j.response.text()}async solveChallenge(j,$){let Z=`${j.url} is behind a Cloudflare challenge`;if(j.init.method!=="GET"||!Zj())throw new P(Z,$.status);try{let z=await zj(j.url);return new A($,z)}catch(z){let J=z instanceof Error?z.message:String(z);throw new P(`${Z} and the solver failed: ${J}`,$.status)}}async fetchWithRetries(j){let $="";for(let Z=0;Z<=j.retries;Z++){if(Z>0)await k0(U0*Z);try{let z=await this.fetchOnce(j);if(!this.shouldRetry(z)||Z===j.retries)return z}catch(z){$=z instanceof Error?z.message:String(z)}}throw new W("source_offline",`${j.url} is unreachable: ${$}`)}shouldRetry(j){let $=j.response.status;if($<500)return!1;return!Mj($,j.response.headers,j.bodyText||"")}async fetchOnce(j){let $=await this.fetchImplementation(j.url,this.withTimeout(j));if($.status!==503)return{response:$};return{response:$,bodyText:await $.text()}}}var m0=[404,410],E0=/not found|missing|deleted|removed|does not exist/i;function Hj(j){return m0.includes(j)}async function q(j,$,Z={}){try{return await $.http.get(j,Z)}catch(z){if(z instanceof B&&z.status!==void 0&&Hj(z.status))throw new I(`${j} no longer exists (HTTP ${z.status})`,z.status);throw z}}function U(j,$,Z){if($.test(j))throw new I(`${Z} says the file does not exist`)}function y0(j){try{let $=JSON.parse(j);if(typeof $.error==="string")return $.error;return""}catch{return""}}function p(j,$){if(!Hj(j))return!1;return E0.test(y0($))}function Kj(j,$,Z){if(p($,Z))throw new I(`${j} reports the video as missing (HTTP ${$})`,$);throw g(j,$)}function M(j){return j}function b0(j,$){return j.domains.some((Z)=>$===Z||$.endsWith("."+Z))}class O{fallback;hosters;constructor(j=[],$){this.fallback=$;this.hosters=[...j]}register(j){this.hosters.push(j)}find(j){let $=v(j);if($==="")return;return this.hosters.find((Z)=>b0(Z,$))}supports(j){return this.find(j)!==void 0}nameOf(j){let $=this.find(j);if(!$)return;return $.name}domains(){return this.hosters.flatMap((j)=>j.domains)}async retrieve(j,$){let Z=this.find(j);if(Z)return Z.retrieve(j,$);let z=await $.http.finalUrl(j),J=this.find(z);if(J)return J.retrieve(z,$);if(!this.fallback)throw Error(`no hoster serves ${j}`);return this.fallback.retrieve(z,$)}}var Nj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",f0=10,x0=/dsplayer\.hotkeys[^']+'([^']+)[\s\S]+?function\s*makePlay[\s\S]+?return[^?]+([^"]+)/,h0=/<title>\s*(Video|File) not found/i;function c0(){let j="";for(let $=0;$<f0;$++)j+=Nj[Math.floor(Math.random()*Nj.length)];return j}async function g0(j,$){let Z=await q(j,$,{referer:G(j)+"/"}),z=Z.url||j,Q=(await Z.text()).match(/<iframe\s*src="([^"]+)/),X=z.replace("/d/","/e/");if(Q)X=C(z,Q[1]);let Y=await(await q(X,$,{referer:z})).text();return U(Y,h0,X),Y}async function p0(j,$){let Z=j.replace("/e/","/d/"),J=(await g0(Z,$)).match(x0);if(!J)throw new W("extraction_failed",`Dood: no player script on ${j}`);let Q=G(Z),V=(await(await $.http.get(C(Q+"/",J[1]),{referer:Q+"/"})).text()).trim(),Y={Referer:Q+"/"};if(V.includes("cloudflarestorage."))return{url:V,mime_type:"video/mp4",headers:Y};return{url:V+c0()+J[2]+Date.now(),mime_type:"video/mp4",headers:Y}}var Ij=M({name:"Doodstream",domains:["dood.watch","doodstream.com","dood.to","dood.so","dood.cx","dood.la","dood.ws","dood.sh","doodstream.co","dood.pm","dood.wf","dood.re","dood.yt","dooood.com","dood.stream","ds2play.com","doods.pro","ds2video.com","d0o0d.com","do0od.com","d0000d.com","d000d.com","dood.li","dood.work","dooodster.com","vidply.com","all3do.com","do7go.com","doodcdn.io","doply.net","vide0.net","vvide0.com","d-s.io","dsvplay.com","myvidplay.com","playmogo.com"],retrieve:p0});var u;function H(j,$){let Z=0,z=j,J=$;while(J>0){if(J&1)Z^=z;if(z<<=1,z&256)z^=283;J>>=1}return Z}function S(j,$){return(j<<$|j>>8-$)&255}function u0(){let j=new Uint8Array(256),$=new Uint8Array(256);for(let Z=1;Z<256;Z++)for(let z=1;z<256;z++)if(H(Z,z)===1)$[Z]=z;for(let Z=0;Z<256;Z++){let z=$[Z];j[Z]=z^S(z,1)^S(z,2)^S(z,3)^S(z,4)^99}return j}function l0(){if(!u)u={substitutionBox:u0()};return u}function o0(j,$){let Z=j.length/4,z=Z+6,J=new Uint8Array(16*(z+1));J.set(j);let Q=1;for(let X=Z;X<4*(z+1);X++){let V=J.slice((X-1)*4,X*4);if(X%Z===0)V.set([$[V[1]]^Q,$[V[2]],$[V[3]],$[V[0]]]),Q=H(Q,2);else if(Z>6&&X%Z===4)for(let Y=0;Y<4;Y++)V[Y]=$[V[Y]];for(let Y=0;Y<4;Y++)J[X*4+Y]=J[(X-Z)*4+Y]^V[Y]}return J}function l(j,$,Z){for(let z=0;z<16;z++)j[z]^=$[Z*16+z]}function Bj(j,$){for(let Z=0;Z<16;Z++)j[Z]=$[j[Z]]}function Fj(j){let $=j.slice();for(let Z=0;Z<4;Z++)for(let z=0;z<4;z++)j[Z*4+z]=$[(Z+z)%4*4+z]}function d0(j){for(let $=0;$<4;$++){let[Z,z,J,Q]=j.slice($*4,$*4+4);j[$*4]=H(Z,2)^H(z,3)^J^Q,j[$*4+1]=Z^H(z,2)^H(J,3)^Q,j[$*4+2]=Z^z^H(J,2)^H(Q,3),j[$*4+3]=H(Z,3)^z^J^H(Q,2)}}function o(j,$,Z){let z=$.length/16-1,J=j.slice();l(J,$,0);for(let Q=1;Q<z;Q++)Bj(J,Z),Fj(J),d0(J),l(J,$,Q);return Bj(J,Z),Fj(J),l(J,$,z),J}function n0(j){for(let $=15;$>=12;$--)if(j[$]=j[$]+1&255,j[$]!==0)return}function _j(j,$){let Z=new Uint8Array(16),z=$.slice();for(let J=0;J<128;J++){if(j[J>>3]&128>>(J&7))for(let X=0;X<16;X++)Z[X]^=z[X];let Q=z[15]&1;for(let X=15;X>0;X--)z[X]=z[X]>>1|(z[X-1]&1)<<7;if(z[0]>>=1,Q)z[0]^=225}return Z}function a0(j,$){let Z=new Uint8Array(16),z=new Uint8Array(16);new DataView(z.buffer).setUint32(12,$.length*8);for(let J=0;J<$.length;J+=16){let Q=$.subarray(J,J+16);for(let X=0;X<Q.length;X++)Z[X]^=Q[X];Z=_j(Z,j)}for(let J=0;J<16;J++)Z[J]^=z[J];return _j(Z,j)}function i0(j,$){let Z=0;for(let z=0;z<16;z++)Z|=j[z]^$[z];return Z===0}function wj(j,$,Z){if(j.length!==16&&j.length!==24&&j.length!==32)throw Error("AES-GCM: invalid key length");if($.length!==12)throw Error("AES-GCM: only 12 byte nonces are supported");if(Z.length<16)throw Error("AES-GCM: data shorter than the tag");let{substitutionBox:z}=l0(),J=o0(j,z),Q=Z.subarray(0,Z.length-16),X=Z.subarray(Z.length-16),V=new Uint8Array(16);V.set($),V[15]=1;let Y=o(V,J,z),E=o(new Uint8Array(16),J,z),_=a0(E,Q);for(let D=0;D<16;D++)_[D]^=Y[D];if(!i0(_,X))throw Error("AES-GCM: authentication failed");let jj=new Uint8Array(Q.length);for(let D=0;D<Q.length;D+=16){n0(V);let Q0=o(V,J,z),X0=Math.min(16,Q.length-D);for(let w=0;w<X0;w++)jj[D+w]=Q[D+w]^Q0[w]}return jj}var s0=2;function Lj(j,$,Z){return{url:j,mime_type:Z.extract.mimeType(j,"application/x-mpegURL"),headers:{Referer:G($.url)+"/"}}}function r0(j,$){let Z=j.match(/data-hls-url="([^"]+)/);if(Z)return Z[1].replace(/&/g,"&");let z=$.extract.mediaUrls(j),J=z.find((Q)=>Q.mime_type==="application/x-mpegURL");if(J)return J.url;if(z.length>0)return z[0].url;return}async function t0(j,$,Z,z){if(Z===0)return q(j,z,{referer:$});return z.http.get(j,{referer:$})}async function Oj(j,$,Z,z){let J=await t0(j,$,Z,z),Q={url:J.url||j,html:await J.text()},X=r0(Q.html,z);if(X)return Lj(X,Q,z);if(Z>=s0)return;let V=z.extract.iframes(Q.html,Q.url);if(V.length===0)return;return Oj(V[0],Q.url,Z+1,z)}var e0=20;function R(j){let $=j.replace(/-/g,"+").replace(/_/g,"/"),Z=(4-$.length%4)%4;return Uint8Array.from(Buffer.from($+"=".repeat(Z),"base64"))}function j1(j){let $=parseInt(j.version,10);if(!($>=1&&$<=e0))throw new W("extraction_failed",`Filemoon: unknown playback version ${j.version}`);let Z=R(j.key_parts[$-1]),z=R(j.key_parts[31-$-1]),J=new Uint8Array(Z.length+z.length);return J.set(Z),J.set(z,Z.length),J}function $1(j){let $=wj(j1(j),R(j.iv),R(j.payload));return JSON.parse(Buffer.from($).toString("utf8")).sources||[]}function Z1(j){let $;for(let Z of j)if(!$||(Z.height||0)>($.height||0))$=Z;return $}function z1(j){let $=new URL(j).pathname.split("/").filter(Boolean);return $[$.length-1]||""}function J1(j){try{return JSON.parse(j)}catch{return{}}}async function Q1(j,$){let Z=z1(j);if(Z==="")return;let z=G(j),J=await $.http.get(`${z}/api/videos/${Z}`,{referer:`${z}/e/${Z}`,allow_error_status:!0}),Q=await J.text();if(p(J.status,Q))throw new I(`Filemoon: ${j} reports the video as missing`,J.status);if(J.status>=400)return;let X=J1(Q);if(!X.playback)return;let V=Z1($1(X.playback));if(!V)return;return Lj(V.url,{url:z+"/",html:""},$)}async function X1(j,$){let Z=await Q1(j,$);if(Z)return Z;let z=await Oj(j,G(j)+"/",0,$);if(!z)throw new W("extraction_failed",`Filemoon: no stream found on ${j}`);return z}var vj=M({name:"Filemoon",domains:["filemoon.sx","filemoon.to","filemoon.in","filemoon.link","filemoon.nl","filemoon.org"],retrieve:X1});var Pj=require("node-html-parser");var V1=["application/x-mpegURL","application/dash+xml","video/mp4","video/webm"];function Y1(j){for(let $ of V1){let Z=j.find((z)=>z.mime_type===$);if(Z)return Z}return}function W1(j,$){let Z=Pj.parse(j);for(let z of Z.querySelectorAll("video[src], source[src]")){let J=z.getAttribute("src")||"";if(J.startsWith("http")||J.startsWith("//")){let Q=$.http.absolute(J);return{url:Q,mime_type:$.extract.mimeType(Q)}}}return}function Aj(j,$){let Z=W1(j,$);if(Z)return Z;return Y1($.extract.mediaUrls(j))}async function G1(j,$,Z){for(let z of Z.extract.iframes(j,$))try{let J=await Z.http.get(z,{referer:$}),Q=Aj(await J.text(),Z);if(Q)return Q}catch{Z.log(`generic: skipping unreachable frame ${z}`)}return}var Uj=M({name:"Generic",domains:[],async retrieve(j,$){let z=await(await q(j,$)).text(),J=Aj(z,$)||await G1(z,j,$);if(!J)throw new W("extraction_failed",`no stream URL found at ${j}`);return{url:J.url,mime_type:J.mime_type}}});var M1=/ById\('.+?=\s*(["']\/\/[^;<]+)/g;function q1(j){let $="";for(let Z of j.replace(/'/g,'"').split("+")){let z=Z.match(/"([^"]*)/);if(!z)continue;let J=0;for(let Q of Z.matchAll(/substring\((\d+)/g))J+=parseInt(Q[1],10);$+=z[1].slice(J)}return $}function C1(j){let $=Array.from(j.matchAll(M1));if($.length===0)return;return $[$.length-1][1]}async function D1(j,$){let Z=G(j),z=j.replace("/v/","/e/"),J=await q(z,$,{referer:Z+"/"}),Q=C1(await J.text());if(!Q)throw new W("extraction_failed",`Streamtape: no video link on ${j}`);let X=C(z,q1(Q)+"&stream=1"),V={Referer:Z+"/"};return{url:(await $.http.get(X,{headers:V,follow_redirects:!1})).response().headers.get("location")||X,mime_type:"video/mp4",headers:V}}var Sj=M({name:"Streamtape",domains:["streamtape.com","strtape.cloud","streamtape.net","streamta.pe","streamtape.site","strcloud.link","strcloud.club","strtpe.link","streamtape.cc","scloud.online","stape.fun","streamadblockplus.com","shavetape.cash","streamtape.to","streamta.site","streamadblocker.xyz","tapewithadblock.org","adblocktape.wiki","antiadtape.com","streamtape.xyz","tapeblocker.com","streamnoads.com","tapeadvertisement.com","tapeadsenjoyer.com","watchadsontape.com","tpead.net","advertape.net","strtape.site","strtapeadblock.me","gettapeads.com","streamtapeadblock.art","streamtapeadblockuser.xyz","advtpe.com"],retrieve:D1});function H1(j){let $=new URL(j).pathname.split("/").filter(Boolean),Z=$[$.length-1];if(!Z)throw new W("extraction_failed",`Vidara: no file code in ${j}`);return Z}async function K1(j,$){let Z=H1(j),z=G(j),J=`${z}/e/${Z}`,Q=await $.http.post(`${z}/api/stream`,{json:{filecode:Z,device:"web"},headers:{Referer:J,Origin:z},allow_error_status:!0}),X=await Q.text();if(Q.status>=400)Kj(Q.url||`${z}/api/stream`,Q.status,X);let V=JSON.parse(X);if(!V.streaming_url)throw new W("extraction_failed",`Vidara: no streaming_url for ${j}`);return{url:V.streaming_url,mime_type:$.extract.mimeType(V.streaming_url,"application/x-mpegURL"),headers:{Referer:J,Origin:z}}}var Rj=M({name:"Vidara",domains:["vidara.to","vidara.so","vidaraa.cc","odysseusa.cc"],retrieve:K1});var N1="https://www.google.com/recaptcha/api.js",kj="https://www.google.com/recaptcha/api2/anchor",I1="https://www.google.com/recaptcha/api2/reload";function B1(j){let $=j.match(/(?:src="https:\/\/www\.google\.com\/recaptcha\/api\.js\?.*?render|data-sitekey)="?([^"&]+)/);if(!$)return;return $[1]}function Tj(j){return Buffer.from(`${j}:443`).toString("base64").replace(/=+$/,"")}async function F1(j,$,Z){let J=(await(await $.http.get(`${N1}?render=${j}`,{referer:Z})).text()).match(/releases\/([^/]+)/);if(!J)return;return J[1]}async function _1(j,$,Z,z,J){let Q=new URLSearchParams({ar:"1",k:j,co:Tj($),hl:"en",v:Z,size:"invisible",cb:"123456789"}),V=(await(await z.http.get(`${kj}?${Q.toString()}`,{referer:J})).text()).match(/recaptcha-token.+?="([^"]+)/);if(!V)return;return V[1]}async function mj(j,$,Z){let z=B1(j);if(!z)return"";let J=G($),Q=await F1(z,Z,$);if(!Q)return"";let X=await _1(z,J,Q,Z,$);if(!X)return"";let Y=(await(await Z.http.post(`${I1}?k=${z}`,{body:{v:Q,reason:"q",k:z,c:X,sa:"",co:Tj(J)},referer:kj})).text()).match(/rresp","([^"]+)/);if(!Y)return"";return Y[1]}var w1=/class="container error"[\s\S]{0,400}?Video not found/i;function L1(j){let $=new URL(j).pathname.split("/").filter(Boolean).pop();return`${G(j)}/e/${$}`}async function O1(j,$){let Z=L1(j),z=G(Z),J=Z.split("/").pop(),X=await(await q(Z,$,{referer:Z})).text();U(X,w1,Z);let V=X.match(/name="token"\s*content="([^"]+)/),Y=X.match(/<video[\s\S]+?data-base="([^"]+)/);if(!V||!Y)throw new W("extraction_failed",`Vinovo: no player data on ${Z}`);let _=await(await $.http.post(`${z}/api/file/url/${J}`,{body:{token:V[1],recaptcha:await mj(X,Z,$)},headers:{Origin:z,Referer:z+"/","X-Requested-With":"XMLHttpRequest"}})).json();if(_.status!=="ok"||!_.token)throw new W("extraction_failed",`Vinovo: file url refused for ${Z}`);return{url:`${Y[1]}/stream/${_.token}`,mime_type:"video/mp4",headers:{Referer:z+"/"}}}var Ej=M({name:"Vinovo",domains:["vinovo.to","vinovo.si"],retrieve:O1});var k=["@$","^^","~@","%?","*~","!!","#&"];function yj(j){return j.replace(/[A-Za-z]/g,($)=>{let Z=$<="Z"?65:97;return String.fromCharCode(($.charCodeAt(0)-Z+13)%26+Z)})}function bj(j,$){return Array.from(j,(Z)=>String.fromCharCode(Z.charCodeAt(0)-$)).join("")}function d(j){return Array.from(j).reverse().join("")}function v1(j,$){return $.reduce((Z,z)=>Z.split(z).join(""),j)}function P1(j,$){let Z=v1(yj(j),$);return F(d(bj(F(Z),3)))}function A1(j){let $=[["direct_access_url",!0],["mp4",!0],["source",!1],["hls",!1],["file",!1]];for(let[Z,z]of $){let J=j[Z];if(typeof J!=="string"||J==="")continue;if(z)return{url:J,mime_type:"video/mp4"};return{url:J,mime_type:L(J,"application/x-mpegURL")}}return}function U1(j){let $=j.match(/https?:\/\/[^\s"']+\.m3u8[^\s"']*/i);if($)return{url:$[0],mime_type:"application/x-mpegURL"};let Z=j.match(/https?:\/\/[^\s"']+\.mp4[^\s"']*/i);if(Z)return{url:Z[0],mime_type:"video/mp4"};return}function n(j){try{return A1(JSON.parse(j))}catch{return U1(j)}}function a(j){try{return j()}catch{return}}function fj(j){let $=j.match(/MKGMa="([^"]+)"/);if(!$)return;return a(()=>{let Z=yj($[1]).replace(/_/g,"");return n(F(d(bj(F(Z),3))))})}function xj(j){let $=j.match(/a168c\s*=\s*'([^']+)'/);if(!$)return;return a(()=>n(d(F($[1].replace(/\\/g,"")))))}function hj(j,$){let Z=j.matchAll(/<script[^>]+type=["']application\/json["'][^>]*>([\s\S]*?)<\/script>/gi);for(let z of Z){let J=a(()=>{let Q=JSON.parse(z[1].trim());if(!Array.isArray(Q)||typeof Q[0]!=="string")return;return n(P1(Q[0],$))});if(J)return J}return}function cj(j){let $=j.match(/\[(?:'\W{2}'[,\]]){1,9}/);if(!$)return;return $[0].slice(2,-2).split("','")}var S1=[/"hls"\s*:\s*"(https?:[^"]+\.m3u8[^"]*)"/i,/'hls'\s*:\s*'(https?:[^']+\.m3u8[^']*)'/i,/"file"\s*:\s*"(https?:[^"]+\.m3u8[^"]*)"/i,/src\s*:\s*["'](https?:[^"']+\.m3u8[^"']*)["']/i,/"file"\s*:\s*"(https?:[^"]+\.mp4[^"]*)"/i,/'file'\s*:\s*'(https?:[^']+\.mp4[^']*)'/i,/mp4["']:\s*["']([^"']+)["']/i];function gj(j){for(let $ of S1){let Z=$.exec(j);if(Z)return{url:Z[1],mime_type:L(Z[1])}}return}var pj=["voe.sx","voe-unblock.com","voe-unblock.net","voeunblock.com","un-block-voe.net","voeunbl0ck.com","voeunblck.com","voeunblk.com","voe-un-block.com","jonathansociallike.com","voeun-block.net","v-o-e-unblock.com","edwardarriveoften.com","nathanfromsubject.com","audaciousdefaulthouse.com","launchreliantcleaverriver.com","kennethofficialitem.com","reputationsheriffkennethsand.com","fittingcentermondaysunday.com","lukecomparetwo.com","housecardsummerbutton.com","fraudclatterflyingcar.com","wolfdyslectic.com","bigclatterhomesguideservice.com","uptodatefinishconferenceroom.com","jayservicestuff.com","realfinanceblogcenter.com","tinycat-voe-fashion.com","35volitantplimsoles5.com","20demidistance9elongations.com","telyn610zoanthropy.com","toxitabellaeatrebates306.com","greaseball6eventual20.com","745mingiestblissfully.com","19turanosephantasia.com","30sensualizeexpression.com","321naturelikefurfuroid.com","449unceremoniousnasoseptal.com","guidon40hyporadius9.com","cyamidpulverulence530.com","boonlessbestselling244.com","antecoxalbobbing1010.com","matriculant401merited.com","scatch176duplicities.com","availedsmallest.com","counterclockwisejacky.com","simpulumlamerop.com","paulkitchendark.com","metagnathtuggers.com","gamoneinterrupted.com","chromotypic.com","crownmakermacaronicism.com","generatesnitrosate.com","yodelswartlike.com","figeterpiazine.com","strawberriesporail.com","valeronevijao.com","timberwoodanotia.com","apinchcaseation.com","nectareousoverelate.com","nonesnanking.com","kathleenmemberhistory.com","stevenimaginelittle.com","jamiesamewalk.com","bradleyviewdoctor.com","sandrataxeight.com","graceaddresscommunity.com","shannonpersonalcost.com","cindyeyefinal.com","michaelapplysome.com","sethniceletter.com","brucevotewithin.com","rebeccaneverbase.com","loriwithinfamily.com","roberteachfinal.com","erikcoldperson.com","jasminetesttry.com","heatherdiscussionwhen.com","robertplacespace.com","alleneconomicmatter.com","josephseveralconcern.com","donaldlineelse.com","lisatrialidea.com","toddpartneranimal.com","jamessoundcost.com","brittneystandardwestern.com","sandratableother.com","robertordercharacter.com","maxfinishseveral.com","chuckle-tube.com","kristiesoundsimply.com","adrianmissionminute.com","richardsignfish.com","jennifercertaindevelopment.com","diananatureforeign.com","goofy-banana.com","mariatheserepublican.com","johnalwayssame.com","kellywhatcould.com","jilliandescribecompany.com","lukesitturn.com","mikaylaarealike.com","christopheruntilpoint.com","walterprettytheir.com","crystaltreatmenteast.com","lauradaydo.com","smoki.cc","lancewhosedifficult.com","ogladaj.me","dianaavoidthey.com","jefferycontrolmodel.com","marissasharecareer.com","charlestoughrace.com","ianrequireadult.com","timmaybealready.com","jessicayeahcatch.com","johnbeyondnation.com","jeanprofessorcentral.com","juliewomanwish.com","garylargeavailable.com","jennifereconomicgive.com","pamelachangemission.com","ellenpoliticalfollow.com","caseyimpactstation.com","matthewhotelscience.com","jessicachoosemake.com","stevenfamilyedge.com","tracylocalschool.com","eugenemakedraw.com","johnfullwonder.com","katherineschoolphone.com","jamesbornmain.com","jeremyparticipantanything.com","teresapoliticallearn.com","megankiddifference.com",...Array.from({length:10},(j,$)=>`voeunblock${$+1}.com`)];var R1=3,k1=3000;function T1(j){if(j.length>k1)return;if(!/permanentToken|const currentUrl/.test(j))return;let $=j.match(/}\s*else\s*\{[^}]*window\.location\.href\s*=\s*['"]([^'"]+)['"]/);if($)return $[1];let Z=j.match(/window\.location\.href\s*=\s*['"]([^'"]+)['"]/);if(Z)return Z[1];return}async function m1(j,$){let Z=j;for(let z=0;z<R1;z++){let Q=await(await q(Z,$)).text(),X=T1(Q);if(!X)return{url:Z,html:Q};Z=C(Z,X)}throw new W("extraction_failed",`VOE: too many redirect pages from ${j}`)}async function E1(j,$,Z){let z=j.match(/json">\["[^"]+"\]<\/script>\s*<script\s*src="([^"]+)"/);if(!z)return k;try{let J=await Z.http.get(C($,z[1]),{referer:$});return cj(await J.text())||k}catch{return k}}async function y1(j,$){let Z=await E1(j.html,j.url,$);return hj(j.html,Z)||fj(j.html)||xj(j.html)||gj(j.html)}async function b1(j,$){let Z=await m1(j,$),z=await y1(Z,$);if(!z)throw new W("extraction_failed",`VOE: no stream found on ${Z.url}`);return{...z,headers:{Referer:G(Z.url)+"/"}}}var uj=M({name:"VOE",domains:pj,retrieve:b1});var i=new O([uj,Rj,Ij,vj,Sj,Ej],Uj);var f1={ä:"ae",ö:"oe",ü:"ue",ß:"ss",æ:"ae",œ:"oe",ø:"o",đ:"d",ł:"l",ð:"d",þ:"th",ı:"i"},x1=/[äöüßæœøđłðþı]/g,h1=/[\u0300-\u036f]/g,c1=/['\u2018\u2019`\u00b4]/g,g1=/[\s\u00a0-\u00bf\u2000-\u206f!-\/:-@\[-`{-~]+/g,p1=/\s*\(\d{4}\)\s*$/,u1=["and","und"],l1=["the","der","die","das"];function T(j){return j.toLowerCase().replace(x1,(Q)=>f1[Q]).normalize("NFD").replace(h1,"").replace(c1,"").replace(g1," ").trim()}function oj(j){let Z=T(j.replace(p1,"")).split(" ").filter((z)=>!u1.includes(z));if(Z.length>1&&l1.includes(Z[0]))Z.shift();return Z.join(" ")}function dj(j){if(j.object==="movie")return j;return j.series}function o1(j){let $=dj(j),Z=[$.title,$.original_title],z=[];for(let J of Z)if(J)z.push(oj(J));return z}function nj(j,$){let Z=oj(j);if(Z==="")return!1;return o1($).includes(Z)}function d1(j){if(typeof j==="string")return j;let $=j.title;if(typeof $==="string")return $;return""}function lj(j,$){if(j===void 0||$===void 0)return 2;let Z=Math.abs(j-$);if(Z===0)return 0;if(Z===1)return 1;return 3}function n1(j,$,Z={}){let z=Z.title||d1,J=j.filter((Y)=>nj(z(Y),$));if(J.length===0)return;if(!Z.year)return J[0];let Q=dj($).year,X=Z.year,V=J[0];for(let Y of J)if(lj(X(Y),Q)<lj(X(V),Q))V=Y;return V}var s={normalize:T,titles:nj,best:n1};var a1="OTTER_BASE_URL";function i1(j,$){let z=($[a1]||"").trim()||j.base_url;if(!z)return;return z.replace(/\/+$/,"")}function s1(j,$){let Z={};for(let z of j.settings||[]){let J=$[z.key]||z.default;if(J!==void 0)Z[z.key]=J}return Z}function r1(j){if(j===void 0)return"";try{return" "+JSON.stringify(j)}catch{return" "+String(j)}}function aj(j,$={}){let Z=$.env||process.env,z=i1(j,Z),J=j.languages||[];return{plugin:{id:j.id,name:j.name,version:j.version,base_url:z,languages:J},http:Cj({baseUrl:z,languages:J,fetch:$.fetch}),match:s,extract:c,hosters:i,settings:s1(j,Z),log(Q,X){console.error(`[${j.id}] ${Q}${r1(X)}`)},list(Q){return{object:"list",data:Q}}}}async function ij(j){let $=Date.now();return{...await j(),load_time_ms:Date.now()-$}}function sj(j){return!("meta"in j)}function t1(j){let $=[];if(j.streams)$.push("streams");if(j.sources)$.push("resolve");if(j.subtitles)$.push("subtitles");return $}function e1(j){if(!j.sources)return;let $=[...j.sources.domains];if(j.sources.fallback)$.push("*");return $}function j$(j){return{name:j.id,display_name:j.name,description:j.description,icon:j.icon,version:j.version,capabilities:t1(j),domains:e1(j),settings:j.settings,requires_solver:j.requires_solver,base_url:j.base_url,languages:j.languages,media:j.media}}function r(j){if(j.tmdb_id)return String(j.tmdb_id);if(j.imdb_id)return j.imdb_id;return T(j.title).replace(/ /g,"-")}function $$(j){return{object:"movie",id:`movie:${r(j)}`,title:j.title,original_title:j.original_title,year:j.year,tmdb_id:j.tmdb_id,imdb_id:j.imdb_id}}function Z$(j){return{object:"series",id:`series:${r(j)}`,title:j.title,original_title:j.original_title,year:j.year,tmdb_id:j.tmdb_id,imdb_id:j.imdb_id}}function z$(j){let $=j.season_number||0,Z=j.episode_number||0;return{object:"episode",id:`episode:${r(j)}:${$}:${Z}`,series:Z$(j),season_number:$,episode_number:Z}}function rj(j){let $=$$(j);if(j.media_type==="episode")$=z$(j);return{media:$}}function J$(j){return{media:rj(j).media,languages:j.languages||[]}}function Q$(j,$){if(j.label)return j.label;let Z=$.hosters.nameOf(j.url);if(Z)return Z;return v(j.url)||"Stream"}function X$(j,$){return{...j,object:"stream",label:Q$(j,$),language:V$(j,$)}}function V$(j,$){if(j.language)return j.language;if($.plugin.languages.length!==1)return;return $.plugin.languages[0]}function Y$(j){return{label:j.label,url:j.url,quality:j.quality,language:j.language,format:j.format,size_bytes:j.size_bytes}}function W$(j){return{...j,object:"subtitle",format:j.format||"srt"}}function G$(j){return{url:j.url,language:j.language,format:j.format,label:j.label,release:j.release,hearing_impaired:j.hearing_impaired,headers:j.headers}}function M$(j){return{...j,object:"source"}}function q$(j){return{url:j.url,mime_type:j.mime_type,headers:j.headers,quality:j.quality}}class tj{definition;ctx;constructor(j,$={}){this.definition=j;this.ctx=aj(j,$)}async listStreams(j){let $=this.definition.streams;if(!$)throw Error("streams not implemented");let Z=await $.list(j,this.ctx);return this.ctx.list(Z.data.map((z)=>X$(z,this.ctx)))}async listSubtitles(j){let $=this.definition.subtitles;if(!$)throw Error("subtitles not implemented");let Z=await $.list(j,this.ctx);return this.ctx.list(Z.data.map(W$))}async retrieveSource(j){let $=this.definition.sources;if(!$)throw Error("resolve not implemented");return M$(await $.retrieve(j,this.ctx))}}function ej(j,$={}){let Z=new tj(j,$),z={meta:j$(j)};if(j.streams)z.streams=async(J)=>{return{downloads:(await Z.listStreams(rj(J))).data.map(Y$)}};if(j.subtitles)z.subtitles=async(J)=>{return{subtitles:(await Z.listSubtitles(J$(J))).data.map(G$)}};if(j.sources)z.resolve=(J)=>ij(async()=>q$(await Z.retrieveSource({url:J})));return z}function m(j){t.writeSync(1,JSON.stringify({result:j})+`
|
|
3
|
+
`),process.exit(0)}function N(j,$){t.writeSync(1,JSON.stringify({error:j,code:$})+`
|
|
4
|
+
`),process.exit(0)}async function C$(){let j=await Bun.stdin.text();try{return JSON.parse(j)}catch{N("invalid JSON on stdin")}}async function D$(j,$){if($.capability==="meta")m(j.meta);if($.capability==="streams"){if(!j.streams)N("streams not implemented");m(await j.streams($.args))}if($.capability==="subtitles"){if(!j.subtitles)N("subtitles not implemented");m(await j.subtitles($.args))}if($.capability==="resolve"){if(!j.resolve)N("resolve not implemented");let Z=$.args?.url;if(!Z)N("args.url required for resolve");m(await j.resolve(String(Z)))}N(`unsupported capability: ${$.capability}`)}function H$(j){if(j instanceof K)N(j.message,j.code);N(j instanceof Error?j.message:String(j))}async function e(j){let $=await C$();try{let Z=sj(j)?ej(j):j;return await D$(Z,$)}catch(Z){H$(Z)}}var K$=[["en","eng"],["de","ger","deu"],["fr","fre","fra"],["es","spa"],["it","ita"],["pt","por","pob","pb"],["nl","dut","nld"],["pl","pol"],["ru","rus"],["tr","tur"],["sv","swe"],["da","dan"],["no","nor","nob"],["fi","fin"],["cs","cze","ces"],["sk","slo","slk"],["hu","hun"],["ro","rum","ron"],["bg","bul"],["el","ell","gre"],["he","heb"],["ar","ara"],["zh","chi","zho","zht","zhc"],["ja","jpn"],["ko","kor"],["hi","hin"],["th","tha"],["vi","vie"],["id","ind"],["uk","ukr"],["hr","hrv"],["sr","scc","srp"],["sl","slv"],["lt","lit"],["lv","lav"],["et","est"],["fa","per","fas"],["ca","cat"],["eu","baq","eus"],["gl","glg"],["is","ice","isl"],["ms","may","msa"],["bn","ben"],["ta","tam"],["sq","alb","sqi"],["mk","mac","mkd"],["bs","bos"],["hy","arm","hye"],["ka","geo","kat"]],N$=new Map,I$=new Map;for(let[j,$,...Z]of K$){I$.set(j,$);for(let z of[$,...Z])N$.set(z,j)}var B$={"1":"de","2":"en","3":"de-sub"};function j0(j){let $=[];for(let Z of j.querySelectorAll("li.series-item > a")){let z=Z.getAttribute("href")||"";if(!z.startsWith("/serie/"))continue;$.push({title:Z.text.trim(),path:z})}return $}function $0(j,$,Z){return`${j}/staffel-${$}/episode-${Z}`}function Z0(j,$){let Z=B$[j];if(Z)return Z;return $.toLowerCase()}async function z0({media:j},$){if(j.object!=="episode")return $.list([]);let Z=await F$(j,$);if(!Z)return $.list([]);let z=await _$($0(Z.path,j.season_number,j.episode_number),$);if(!z)return $.list([]);let J=await Promise.all(z.querySelectorAll("button.link-box[data-play-url]").map((Q)=>w$(Q,$)));return $.list(J.filter((Q)=>Q!==null))}async function F$(j,$){let Z=await(await $.http.get("/serien")).html();return $.match.best(j0(Z),j)}async function _$(j,$){try{return await(await $.http.get(j)).html()}catch(Z){if(Z instanceof B&&Z.status===404)return;throw Z}}async function w$(j,$){let Z=j.getAttribute("data-play-url")||"",z=j.getAttribute("data-provider-name")||"";if(!Z||!z)return null;let J=j.getAttribute("data-language-label")||"",Q=j.getAttribute("data-language-id")||"";return{url:await $.http.finalUrl($.http.absolute(Z)),label:`${z} — ${J}`,language:Z0(Q,J)}}var J0=b({id:"s-to",name:"S.to",version:"0.4.0",description:"German streaming aggregator: finds playable streams for episodes on serienstream.to (formerly s.to)",icon:"https://serienstream.to/favicon.ico",base_url:"https://serienstream.to",languages:["de"],media:["episode"],streams:{list:z0}});e(J0);
|
package/README.md
DELETED