update CAT

This commit is contained in:
qist
2024-04-28 14:09:31 +08:00
parent c87c455ba9
commit f41fe949cc
6 changed files with 50 additions and 37 deletions
+3 -3
View File
@@ -395,10 +395,10 @@ function print() { __p += __j.call(arguments, '') }
`,t_e=F5.encode(Rs),n_e=2,Eb=class{constructor(e,n){let{escapeName:r}=this.constructor,l=X.isString(n),i=`Content-Disposition: form-data; name="${r(e)}"${!l&&n.name?`; filename="${r(n.name)}"`:""}${Rs}`;l?n=F5.encode(String(n).replace(/\r?\n|\r\n?/g,Rs)):i+=`Content-Type: ${n.type||"application/octet-stream"}${Rs}`,this.headers=F5.encode(i+Rs),this.contentLength=l?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+n_e,this.name=e,this.value=n}async*encode(){yield this.headers;let{value:e}=this;X.isTypedArray(e)?yield e:yield*lf(e),yield t_e}static escapeName(e){return String(e).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},r_e=(t,e,n)=>{let{tag:r="form-data-boundary",size:l=25,boundary:i=r+"-"+X.generateString(l,e_e)}=n||{};if(!X.isFormData(t))throw TypeError("FormData instance required");if(i.length<1||i.length>70)throw Error("boundary must be 10-70 characters long");let s=F5.encode("--"+i+Rs),a=F5.encode("--"+i+"--"+Rs+Rs),o=a.byteLength,c=Array.from(t.entries()).map(([p,m])=>{let h=new Eb(p,m);return o+=h.size,h});o+=s.byteLength*c.length,o=X.toFiniteNumber(o);let f={"Content-Type":`multipart/form-data; boundary=${i}`};return Number.isFinite(o)&&(f["Content-Length"]=o),e&&e(f),xz.Readable.from(async function*(){for(let p of c)yield s,yield*p.encode();yield a}())},Az=r_e;var wz=br(require("stream"),1),bb=class extends wz.default.Transform{__transform(e,n,r){this.push(e),r()}_transform(e,n,r){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let l=Buffer.alloc(2);l[0]=120,l[1]=156,this.push(l,n)}this.__transform(e,n,r)}},Rz=bb;var l_e=(t,e)=>X.isAsyncFn(t)?function(...n){let r=n.pop();t.apply(this,n).then(l=>{try{e?r(null,...e(l)):r(null,l)}catch(i){r(i)}},r)}:t,Oz=l_e;var Nz={flush:O3.default.constants.Z_SYNC_FLUSH,finishFlush:O3.default.constants.Z_SYNC_FLUSH},i_e={flush:O3.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:O3.default.constants.BROTLI_OPERATION_FLUSH},Iz=X.isFunction(O3.default.createBrotliDecompress),{http:s_e,https:a_e}=Mz.default,o_e=/https:?/,Cz=Or.protocols.map(t=>t+":");function u_e(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function jz(t,e,n){let r=e;if(!r&&r!==!1){let l=(0,Pz.getProxyForUrl)(n);l&&(r=new URL(l))}if(r){if(r.username&&(r.auth=(r.username||"")+":"+(r.password||"")),r.auth){(r.auth.username||r.auth.password)&&(r.auth=(r.auth.username||"")+":"+(r.auth.password||""));let i=Buffer.from(r.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+i}t.headers.host=t.hostname+(t.port?":"+t.port:"");let l=r.hostname||r.host;t.hostname=l,t.host=l,t.port=r.port,t.path=n,r.protocol&&(t.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`)}t.beforeRedirects.proxy=function(i){jz(i,e,i.href)}}var c_e=typeof process<"u"&&X.kindOf(process)==="process",f_e=t=>new Promise((e,n)=>{let r,l,i=(o,c)=>{l||(l=!0,r&&r(o,c))},s=o=>{i(o),e(o)},a=o=>{i(o,!0),n(o)};t(s,a,o=>r=o).catch(a)}),p_e=({address:t,family:e})=>{if(!X.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},kz=(t,e)=>p_e(X.isObject(t)?t:{address:t,family:e}),Uz=c_e&&function(e){return f_e(async function(r,l,i){let{data:s,lookup:a,family:o}=e,{responseType:c,responseEncoding:f}=e,p=e.method.toUpperCase(),m,h=!1,g;if(a){let ae=Oz(a,ye=>X.isArray(ye)?ye:[ye]);a=(ye,q,le)=>{ae(ye,q,(re,te,Un)=>{if(re)return le(re);let wt=X.isArray(te)?te.map(Ge=>kz(Ge)):[kz(te,Un)];q.all?le(re,wt):le(re,wt[0].address,wt[0].family)})}}let _=new $z.default,S=()=>{e.cancelToken&&e.cancelToken.unsubscribe(T),e.signal&&e.signal.removeEventListener("abort",T),_.removeAllListeners()};i((ae,ye)=>{m=!0,ye&&(h=!0,S())});function T(ae){_.emit("abort",!ae||ae.type?new ei(null,e,g):ae)}_.once("abort",l),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(T),e.signal&&(e.signal.aborted?T():e.signal.addEventListener("abort",T)));let x=so(e.baseURL,e.url),v=new URL(x,"http://localhost"),b=v.protocol||Cz[0];if(b==="data:"){let ae;if(p!=="GET")return ws(r,l,{status:405,statusText:"method not allowed",headers:{},config:e});try{ae=yb(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(ye){throw Fe.from(ye,Fe.ERR_BAD_REQUEST,e)}return c==="text"?(ae=ae.toString(f),(!f||f==="utf8")&&(ae=X.stripBOM(ae))):c==="stream"&&(ae=uo.default.Readable.from(ae)),ws(r,l,{data:ae,status:200,statusText:"OK",headers:new Nr,config:e})}if(Cz.indexOf(b)===-1)return l(new Fe("Unsupported protocol "+b,Fe.ERR_BAD_REQUEST,e));let w=Nr.from(e.headers).normalize();w.set("User-Agent","axios/"+oo,!1);let N=e.onDownloadProgress,O=e.onUploadProgress,k=e.maxRate,j,L;if(X.isSpecCompliantForm(s)){let ae=w.getContentType(/boundary=([-_\w\d]{10,70})/i);s=Az(s,ye=>{w.set(ye)},{tag:`axios-${oo}-boundary`,boundary:ae&&ae[1]||void 0})}else if(X.isFormData(s)&&X.isFunction(s.getHeaders)){if(w.set(s.getHeaders()),!w.hasContentLength())try{let ae=await Fz.default.promisify(s.getLength).call(s);Number.isFinite(ae)&&ae>=0&&w.setContentLength(ae)}catch{}}else if(X.isBlob(s))s.size&&w.setContentType(s.type||"application/octet-stream"),w.setContentLength(s.size||0),s=uo.default.Readable.from(lf(s));else if(s&&!X.isStream(s)){if(!Buffer.isBuffer(s))if(X.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else if(X.isString(s))s=Buffer.from(s,"utf-8");else return l(new Fe("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Fe.ERR_BAD_REQUEST,e));if(w.setContentLength(s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return l(new Fe("Request body larger than maxBodyLength limit",Fe.ERR_BAD_REQUEST,e))}let Q=X.toFiniteNumber(w.getContentLength());X.isArray(k)?(j=k[0],L=k[1]):j=L=k,s&&(O||j)&&(X.isStream(s)||(s=uo.default.Readable.from(s,{objectMode:!1})),s=uo.default.pipeline([s,new _b({length:Q,maxRate:X.toFiniteNumber(j)})],X.noop),O&&s.on("progress",ae=>{O(Object.assign(ae,{upload:!0}))}));let Y;if(e.auth){let ae=e.auth.username||"",ye=e.auth.password||"";Y=ae+":"+ye}if(!Y&&v.username){let ae=v.username,ye=v.password;Y=ae+":"+ye}Y&&w.delete("authorization");let Z;try{Z=io(v.pathname+v.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ae){let ye=new Error(ae.message);return ye.config=e,ye.url=e.url,ye.exists=!0,l(ye)}w.set("Accept-Encoding","gzip, compress, deflate"+(Iz?", br":""),!1);let ve={path:Z,method:p,headers:w.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:Y,protocol:b,family:o,beforeRedirect:u_e,beforeRedirects:{}};!X.isUndefined(a)&&(ve.lookup=a),e.socketPath?ve.socketPath=e.socketPath:(ve.hostname=v.hostname,ve.port=v.port,jz(ve,e.proxy,b+"//"+v.hostname+(v.port?":"+v.port:"")+ve.path));let Ne,pe=o_e.test(ve.protocol);if(ve.agent=pe?e.httpsAgent:e.httpAgent,e.transport?Ne=e.transport:e.maxRedirects===0?Ne=pe?Lz.default:Dz.default:(e.maxRedirects&&(ve.maxRedirects=e.maxRedirects),e.beforeRedirect&&(ve.beforeRedirects.config=e.beforeRedirect),Ne=pe?a_e:s_e),e.maxBodyLength>-1?ve.maxBodyLength=e.maxBodyLength:ve.maxBodyLength=1/0,e.insecureHTTPParser&&(ve.insecureHTTPParser=e.insecureHTTPParser),g=Ne.request(ve,function(ye){if(g.destroyed)return;let q=[ye],le=+ye.headers["content-length"];if(N){let Ge=new _b({length:X.toFiniteNumber(le),maxRate:X.toFiniteNumber(L)});N&&Ge.on("progress",$t=>{N(Object.assign($t,{download:!0}))}),q.push(Ge)}let re=ye,te=ye.req||g;if(e.decompress!==!1&&ye.headers["content-encoding"])switch((p==="HEAD"||ye.statusCode===204)&&delete ye.headers["content-encoding"],(ye.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":q.push(O3.default.createUnzip(Nz)),delete ye.headers["content-encoding"];break;case"deflate":q.push(new Rz),q.push(O3.default.createUnzip(Nz)),delete ye.headers["content-encoding"];break;case"br":Iz&&(q.push(O3.default.createBrotliDecompress(i_e)),delete ye.headers["content-encoding"])}re=q.length>1?uo.default.pipeline(q,X.noop):q[0];let Un=uo.default.finished(re,()=>{Un(),S()}),wt={status:ye.statusCode,statusText:ye.statusMessage,headers:new Nr(ye.headers),config:e,request:te};if(c==="stream")wt.data=re,ws(r,l,wt);else{let Ge=[],$t=0;re.on("data",function(Xe){Ge.push(Xe),$t+=Xe.length,e.maxContentLength>-1&&$t>e.maxContentLength&&(h=!0,re.destroy(),l(new Fe("maxContentLength size of "+e.maxContentLength+" exceeded",Fe.ERR_BAD_RESPONSE,e,te)))}),re.on("aborted",function(){if(h)return;let Xe=new Fe("maxContentLength size of "+e.maxContentLength+" exceeded",Fe.ERR_BAD_RESPONSE,e,te);re.destroy(Xe),l(Xe)}),re.on("error",function(Xe){g.destroyed||l(Fe.from(Xe,null,e,te))}),re.on("end",function(){try{let Xe=Ge.length===1?Ge[0]:Buffer.concat(Ge);c!=="arraybuffer"&&(Xe=Xe.toString(f),(!f||f==="utf8")&&(Xe=X.stripBOM(Xe))),wt.data=Xe}catch(Xe){return l(Fe.from(Xe,null,e,wt.request,wt))}ws(r,l,wt)})}_.once("abort",Ge=>{re.destroyed||(re.emit("error",Ge),re.destroy())})}),_.once("abort",ae=>{l(ae),g.destroy(ae)}),g.on("error",function(ye){l(Fe.from(ye,null,e,g))}),g.on("socket",function(ye){ye.setKeepAlive(!0,1e3*60)}),e.timeout){let ae=parseInt(e.timeout,10);if(Number.isNaN(ae)){l(new Fe("error trying to parse `config.timeout` to int",Fe.ERR_BAD_OPTION_VALUE,e,g));return}g.setTimeout(ae,function(){if(m)return;let q=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",le=e.transitional||b4;e.timeoutErrorMessage&&(q=e.timeoutErrorMessage),l(new Fe(q,le.clarifyTimeoutError?Fe.ETIMEDOUT:Fe.ECONNABORTED,e,g)),T()})}if(X.isStream(s)){let ae=!1,ye=!1;s.on("end",()=>{ae=!0}),s.once("error",q=>{ye=!0,g.destroy(q)}),s.on("close",()=>{!ae&&!ye&&T(new ei("Request stream has been aborted",e,g))}),s.pipe(g)}else g.end(s)})};var Bz=Or.hasStandardBrowserEnv?{write(t,e,n,r,l,i){let s=[t+"="+encodeURIComponent(e)];X.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),X.isString(r)&&s.push("path="+r),X.isString(l)&&s.push("domain="+l),i===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Hz=Or.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),r;function l(i){let s=i;return e&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=l(window.location.href),function(s){let a=X.isString(s)?l(s):s;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function qz(t,e){let n=0,r=nf(50,250);return l=>{let i=l.loaded,s=l.lengthComputable?l.total:void 0,a=i-n,o=r(a),c=i<=s;n=i;let f={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:o||void 0,estimated:o&&s&&c?(s-i)/o:void 0,event:l};f[e?"download":"upload"]=!0,t(f)}}var d_e=typeof XMLHttpRequest<"u",Vz=d_e&&function(t){return new Promise(function(n,r){let l=t.data,i=Nr.from(t.headers).normalize(),{responseType:s,withXSRFToken:a}=t,o;function c(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}let f;if(X.isFormData(l)){if(Or.hasStandardBrowserEnv||Or.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if((f=i.getContentType())!==!1){let[_,...S]=f?f.split(";").map(T=>T.trim()).filter(Boolean):[];i.setContentType([_||"multipart/form-data",...S].join("; "))}}let p=new XMLHttpRequest;if(t.auth){let _=t.auth.username||"",S=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(_+":"+S))}let m=so(t.baseURL,t.url);p.open(t.method.toUpperCase(),io(m,t.params,t.paramsSerializer),!0),p.timeout=t.timeout;function h(){if(!p)return;let _=Nr.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),T={data:!s||s==="text"||s==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:_,config:t,request:p};ws(function(v){n(v),c()},function(v){r(v),c()},T),p=null}if("onloadend"in p?p.onloadend=h:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(h)},p.onabort=function(){p&&(r(new Fe("Request aborted",Fe.ECONNABORTED,t,p)),p=null)},p.onerror=function(){r(new Fe("Network Error",Fe.ERR_NETWORK,t,p)),p=null},p.ontimeout=function(){let S=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",T=t.transitional||b4;t.timeoutErrorMessage&&(S=t.timeoutErrorMessage),r(new Fe(S,T.clarifyTimeoutError?Fe.ETIMEDOUT:Fe.ECONNABORTED,t,p)),p=null},Or.hasStandardBrowserEnv&&(a&&X.isFunction(a)&&(a=a(t)),a||a!==!1&&Hz(m))){let _=t.xsrfHeaderName&&t.xsrfCookieName&&Bz.read(t.xsrfCookieName);_&&i.set(t.xsrfHeaderName,_)}l===void 0&&i.setContentType(null),"setRequestHeader"in p&&X.forEach(i.toJSON(),function(S,T){p.setRequestHeader(T,S)}),X.isUndefined(t.withCredentials)||(p.withCredentials=!!t.withCredentials),s&&s!=="json"&&(p.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&p.addEventListener("progress",qz(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&p.upload&&p.upload.addEventListener("progress",qz(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=_=>{p&&(r(!_||_.type?new ei(null,t,p):_),p.abort(),p=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));let g=L5(m);if(g&&Or.protocols.indexOf(g)===-1){r(new Fe("Unsupported protocol "+g+":",Fe.ERR_BAD_REQUEST,t));return}p.send(l||null)})};var Tb={http:Uz,xhr:Vz};X.forEach(Tb,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var zz=t=>`- ${t}`,h_e=t=>X.isFunction(t)||t===null||t===!1,sf={getAdapter:t=>{t=X.isArray(t)?t:[t];let{length:e}=t,n,r,l={};for(let i=0;i<e;i++){n=t[i];let s;if(r=n,!h_e(n)&&(r=Tb[(s=String(n)).toLowerCase()],r===void 0))throw new Fe(`Unknown adapter '${s}'`);if(r)break;l[s||"#"+i]=r}if(!r){let i=Object.entries(l).map(([a,o])=>`adapter ${a} `+(o===!1?"is not supported by the environment":"is not available in the build")),s=e?i.length>1?`since :
`+i.map(zz).join(`
`):" "+zz(i[0]):"as no adapter specified";throw new Fe("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Tb};function Sb(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ei(null,t)}function af(t){return Sb(t),t.headers=Nr.from(t.headers),t.data=O5.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),sf.getAdapter(t.adapter||T4.adapter)(t).then(function(r){return Sb(t),r.data=O5.call(t,t.transformResponse,r),r.headers=Nr.from(r.headers),r},function(r){return N5(r)||(Sb(t),r&&r.response&&(r.response.data=O5.call(t,t.transformResponse,r.response),r.response.headers=Nr.from(r.response.headers))),Promise.reject(r)})}var Gz=t=>t instanceof Nr?t.toJSON():t;function N3(t,e){e=e||{};let n={};function r(c,f,p){return X.isPlainObject(c)&&X.isPlainObject(f)?X.merge.call({caseless:p},c,f):X.isPlainObject(f)?X.merge({},f):X.isArray(f)?f.slice():f}function l(c,f,p){if(X.isUndefined(f)){if(!X.isUndefined(c))return r(void 0,c,p)}else return r(c,f,p)}function i(c,f){if(!X.isUndefined(f))return r(void 0,f)}function s(c,f){if(X.isUndefined(f)){if(!X.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function a(c,f,p){if(p in e)return r(c,f);if(p in t)return r(void 0,c)}let o={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(c,f)=>l(Gz(c),Gz(f),!0)};return X.forEach(Object.keys(Object.assign({},t,e)),function(f){let p=o[f]||l,m=p(t[f],e[f],f);X.isUndefined(m)&&p!==a||(n[f]=m)}),n}var xb={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{xb[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});var Xz={};xb.transitional=function(e,n,r){function l(i,s){return"[Axios v"+oo+"] Transitional option '"+i+"'"+s+(r?". "+r:"")}return(i,s,a)=>{if(e===!1)throw new Fe(l(s," has been removed"+(n?" in "+n:"")),Fe.ERR_DEPRECATED);return n&&!Xz[s]&&(Xz[s]=!0,console.warn(l(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,s,a):!0}};function m_e(t,e,n){if(typeof t!="object")throw new Fe("options must be an object",Fe.ERR_BAD_OPTION_VALUE);let r=Object.keys(t),l=r.length;for(;l-- >0;){let i=r[l],s=e[i];if(s){let a=t[i],o=a===void 0||s(a,i,t);if(o!==!0)throw new Fe("option "+i+" must be "+o,Fe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Fe("Unknown option "+i,Fe.ERR_BAD_OPTION)}}var of={assertOptions:m_e,validators:xb};var Os=of.validators,A4=class{constructor(e){this.defaults=e,this.interceptors={request:new QE,response:new QE}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let l;Error.captureStackTrace?Error.captureStackTrace(l={}):l=new Error;let i=l.stack?l.stack.replace(/^.+\n/,""):"";r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+i):r.stack=i}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=N3(this.defaults,n);let{transitional:r,paramsSerializer:l,headers:i}=n;r!==void 0&&of.assertOptions(r,{silentJSONParsing:Os.transitional(Os.boolean),forcedJSONParsing:Os.transitional(Os.boolean),clarifyTimeoutError:Os.transitional(Os.boolean)},!1),l!=null&&(X.isFunction(l)?n.paramsSerializer={serialize:l}:of.assertOptions(l,{encode:Os.function,serialize:Os.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&X.merge(i.common,i[n.method]);i&&X.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=Nr.concat(s,i);let a=[],o=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(n)===!1||(o=o&&_.synchronous,a.unshift(_.fulfilled,_.rejected))});let c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let f,p=0,m;if(!o){let g=[af.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,c),m=g.length,f=Promise.resolve(n);p<m;)f=f.then(g[p++],g[p++]);return f}m=a.length;let h=n;for(p=0;p<m;){let g=a[p++],_=a[p++];try{h=g(h)}catch(S){_.call(this,S);break}}try{f=af.call(this,h)}catch(g){return Promise.reject(g)}for(p=0,m=c.length;p<m;)f=f.then(c[p++],c[p++]);return f}getUri(e){e=N3(this.defaults,e);let n=so(e.baseURL,e.url);return io(n,e.params,e.paramsSerializer)}};X.forEach(["delete","get","head","options"],function(e){A4.prototype[e]=function(n,r){return this.request(N3(r||{},{method:e,url:n,data:(r||{}).data}))}});X.forEach(["post","put","patch"],function(e){function n(r){return function(i,s,a){return this.request(N3(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}A4.prototype[e]=n(),A4.prototype[e+"Form"]=n(!0)});var M5=A4;var Ab=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});let r=this;this.promise.then(l=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](l);r._listeners=null}),this.promise.then=l=>{let i,s=new Promise(a=>{r.subscribe(a),i=a}).then(l);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,a){r.reason||(r.reason=new ei(i,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new t(function(l){e=l}),cancel:e}}},Wz=Ab;function wb(t){return function(n){return t.apply(null,n)}}function Rb(t){return X.isObject(t)&&t.isAxiosError===!0}var Ob={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ob).forEach(([t,e])=>{Ob[e]=t});var Kz=Ob;function Yz(t){let e=new M5(t),n=x5(M5.prototype.request,e);return X.extend(n,M5.prototype,e,{allOwnKeys:!0}),X.extend(n,e,null,{allOwnKeys:!0}),n.create=function(l){return Yz(N3(t,l))},n}var gr=Yz(T4);gr.Axios=M5;gr.CanceledError=ei;gr.CancelToken=Wz;gr.isCancel=N5;gr.VERSION=oo;gr.toFormData=As;gr.AxiosError=Fe;gr.Cancel=gr.CanceledError;gr.all=function(e){return Promise.all(e)};gr.spread=wb;gr.isAxiosError=Rb;gr.mergeConfig=N3;gr.AxiosHeaders=Nr;gr.formToJSON=t=>ef(X.isHTMLForm(t)?new FormData(t):t);gr.getAdapter=sf.getAdapter;gr.HttpStatusCode=Kz;gr.default=gr;var w4=gr;var{Axios:vCe,AxiosError:_Ce,CanceledError:ECe,isCancel:bCe,CancelToken:TCe,VERSION:SCe,all:xCe,Cancel:ACe,isAxiosError:wCe,spread:RCe,toFormData:Jz,AxiosHeaders:OCe,HttpStatusCode:NCe,formToJSON:ICe,getAdapter:CCe,mergeConfig:kCe}=w4;var iG=br(require("https"),1),sG=br(require("crypto"),1),aG=br(rG(),1),Cb={};globalThis.dataBase=null;globalThis.local={get:async function(t,e){return await S_e(t,e)},set:async function(t,e,n){await x_e(t,e,n)}};async function S_e(t,e){let n="/js_"+t+`/${e}/`;return await dataBase.getObjectDefault(n,{})}async function x_e(t,e,n){let r="/js_"+t;Cb=await dataBase.getObjectDefault(r,{}),Cb[e]=n,t==="log"&&await req("http://192.168.0.116:8099/upload",{data:{log:n+`
`+i):r.stack=i}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=N3(this.defaults,n);let{transitional:r,paramsSerializer:l,headers:i}=n;r!==void 0&&of.assertOptions(r,{silentJSONParsing:Os.transitional(Os.boolean),forcedJSONParsing:Os.transitional(Os.boolean),clarifyTimeoutError:Os.transitional(Os.boolean)},!1),l!=null&&(X.isFunction(l)?n.paramsSerializer={serialize:l}:of.assertOptions(l,{encode:Os.function,serialize:Os.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&X.merge(i.common,i[n.method]);i&&X.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=Nr.concat(s,i);let a=[],o=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(n)===!1||(o=o&&_.synchronous,a.unshift(_.fulfilled,_.rejected))});let c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let f,p=0,m;if(!o){let g=[af.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,c),m=g.length,f=Promise.resolve(n);p<m;)f=f.then(g[p++],g[p++]);return f}m=a.length;let h=n;for(p=0;p<m;){let g=a[p++],_=a[p++];try{h=g(h)}catch(S){_.call(this,S);break}}try{f=af.call(this,h)}catch(g){return Promise.reject(g)}for(p=0,m=c.length;p<m;)f=f.then(c[p++],c[p++]);return f}getUri(e){e=N3(this.defaults,e);let n=so(e.baseURL,e.url);return io(n,e.params,e.paramsSerializer)}};X.forEach(["delete","get","head","options"],function(e){A4.prototype[e]=function(n,r){return this.request(N3(r||{},{method:e,url:n,data:(r||{}).data}))}});X.forEach(["post","put","patch"],function(e){function n(r){return function(i,s,a){return this.request(N3(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}A4.prototype[e]=n(),A4.prototype[e+"Form"]=n(!0)});var M5=A4;var Ab=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});let r=this;this.promise.then(l=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](l);r._listeners=null}),this.promise.then=l=>{let i,s=new Promise(a=>{r.subscribe(a),i=a}).then(l);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,a){r.reason||(r.reason=new ei(i,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new t(function(l){e=l}),cancel:e}}},Wz=Ab;function wb(t){return function(n){return t.apply(null,n)}}function Rb(t){return X.isObject(t)&&t.isAxiosError===!0}var Ob={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ob).forEach(([t,e])=>{Ob[e]=t});var Kz=Ob;function Yz(t){let e=new M5(t),n=x5(M5.prototype.request,e);return X.extend(n,M5.prototype,e,{allOwnKeys:!0}),X.extend(n,e,null,{allOwnKeys:!0}),n.create=function(l){return Yz(N3(t,l))},n}var gr=Yz(T4);gr.Axios=M5;gr.CanceledError=ei;gr.CancelToken=Wz;gr.isCancel=N5;gr.VERSION=oo;gr.toFormData=As;gr.AxiosError=Fe;gr.Cancel=gr.CanceledError;gr.all=function(e){return Promise.all(e)};gr.spread=wb;gr.isAxiosError=Rb;gr.mergeConfig=N3;gr.AxiosHeaders=Nr;gr.formToJSON=t=>ef(X.isHTMLForm(t)?new FormData(t):t);gr.getAdapter=sf.getAdapter;gr.HttpStatusCode=Kz;gr.default=gr;var w4=gr;var{Axios:vCe,AxiosError:_Ce,CanceledError:ECe,isCancel:bCe,CancelToken:TCe,VERSION:SCe,all:xCe,Cancel:ACe,isAxiosError:wCe,spread:RCe,toFormData:Jz,AxiosHeaders:OCe,HttpStatusCode:NCe,formToJSON:ICe,getAdapter:CCe,mergeConfig:kCe}=w4;var iG=br(require("https"),1),sG=br(require("crypto"),1),aG=br(rG(),1),Cb={};globalThis.dataBase=null;globalThis.local={get:async function(t,e){return await S_e(t,e)},set:async function(t,e,n){await x_e(t,e,n)}};async function S_e(t,e){let n="/js_"+t+`/${e}/`;return await dataBase.getObjectDefault(n,{})}async function x_e(t,e,n){let r="/js_"+t;Cb=await dataBase.getObjectDefault(r,{}),Cb[e]=n,t==="log"&&await req("http://127.0.0.1:8099/upload",{data:{log:n+`
`},timeout:.1}),await dataBase.push(r,Cb)}globalThis.localLog={set:async function(t,e,n){w_e(t,e,n)}};function A_e(){co.default.existsSync("log")||co.default.mkdirSync("log");let t="log/info.log";return co.default.existsSync(t)?co.default.readFileSync(t).toString():(co.default.writeFileSync(t,""),"")}function w_e(t){co.default.writeFileSync("log/info.log",A_e()+`
`+t)}globalThis.req=R_e;async function R_e(t,e){try{let n=e&&e.data||null,r=e&&e.postType||null,l=e&&e.buffer||0,i=e&&e.timeout||5e3,s=(e&&e.redirect||1)===1,a=e.proxy??!1,o=e?e.headers||{}:{};r==="form"?(o["Content-Type"]="application/x-www-form-urlencoded",n!=null&&(n=lG.default.stringify(n,{encode:!1}))):r==="form-data"&&(o["Content-Type"]="multipart/form-data",n=Jz(n));let c=l===1||l===2?"arraybuffer":void 0,f;a?f=aG.default.httpsOverHttp({proxy:{host:"127.0.0.1",port:7890}}):f=iG.default.Agent({rejectUnauthorized:!1});let p=await w4(t,{responseType:c,method:e&&e.method||"get",headers:o,data:n,timeout:i,maxRedirects:s?null:0,httpsAgent:f});n=p.data;let m={};for(let h of p.headers){let g=h[1];m[h[0]]=Array.isArray(g)&&g.length===1?g[0]:g}if(!l)typeof n=="object"&&(n=JSON.stringify(n));else{if(l===1)return{code:p.status,headers:m,content:n};if(l===2)return{code:p.status,headers:m,content:n.toString("base64")};if(l===3){let h=e.stream;return h.onResp&&await h.onResp({code:p.status,headers:m}),h.onData?(n.on("data",async g=>{await h.onData(g)}),n.on("end",async()=>{h.onDone&&await h.onDone()})):h.onDone&&await h.onDone(),"stream..."}}return{code:p.status,headers:m,content:n}}catch(n){let r=n.response;try{return{code:r.status,headers:r.headers,content:JSON.stringify(r.data)}}catch{return{headers:{},content:""}}}}globalThis.md5X=O_e;function O_e(t){return sG.default.createHash("md5").update(Buffer.from(t,"utf8")).digest("hex")}globalThis.js2Proxy=function(t,e,n){let r=Object.keys(n).length===0?" ":encodeURIComponent(JSON.stringify(n));return t.server.address().dynamic+t.server.prefix+"/proxy/"+encodeURIComponent(e)+"/"+r+"/"};var N_e=["DEBUG","INFO","WARNING","ERROR"];var O4=class{constructor(e,n="DEBUG"){this.app_name=e,this.level=n,this.level_index=N_e.indexOf(n)}format(e,n){let r=80;switch(e){case"INFO":r=r+1;break;case"WARNING":r=r-2;break;default:break}return n.length<r&&((r-n.length)%2===0?n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)):n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)+1)),n}getTime(){let e=new Date;return e.toLocaleDateString().replace(/\//g,"-")+" "+e.toTimeString().substr(0,8)+","+e.getMilliseconds().toString()}formatMessage(e,n,r){return r&&(n=this.format(e,n)),`${this.getTime()} - ${this.app_name} - ${e}: ${n}`}async log(e){console.debug(e),await req("http://192.168.0.116:8099/upload",{data:{log:e+`
`},timeout:.1})}async info(e,n){this.level_index<=1&&await this.log(this.formatMessage("INFO",e,n))}async warning(e,n){this.level_index<=2&&await this.log(this.formatMessage("WARNING",e,n))}async error(e,n){this.level_index<=3&&await this.log(this.formatMessage("ERROR",e,n))}async debug(e,n){this.level_index<=0&&await this.log(this.formatMessage("DEBUG",e,n))}};var kn=class extends jn{constructor(){super(),this.jadeLog=new O4(this.getAppName(),"DEBUG")}async init(e,n){await this.jadeLog.info("\u521D\u59CB\u5316",!0);try{await await req("http://192.168.0.116:8099/clear",{timeout:.1}),this.siteKey=this.getJSName(),this.siteType=this.getType(),this.cfgObj=e.server.config[this.siteKey],this.deviceKey=e.server.prefix+"/",this.db=e.server.db,this.catOpenStatus=!0,this.danmuStaus=!1;try{await this.loadFilterAndClasses()?await this.jadeLog.debug("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u6210\u529F"):(await this.jadeLog.warning("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u5931\u8D25"),await this.writeFilterAndClasses())}catch(r){await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),await this.jadeLog.error("\u8BFB\u53D6\u7F13\u5B58\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+r,!1)}}catch(r){await this.jadeLog.error(`\u521D\u59CB\u5316\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}await this.jadeLog.info("\u521D\u59CB\u5316\u5B8C\u6210",!0)}async loadFilterAndClasses(){return this.classes=await this.getClassesCache(),this.filterObj=await this.getFiletObjCache(),this.classes.length>0?!0:(await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),!1)}async writeFilterAndClasses(){this.catOpenStatus&&this.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await this.setClasses(),await this.setFilterObj(),await this.db.push(this.deviceKey+"classes",this.classes),await this.db.push(this.deviceKey+"filterObj",this.filterObj)}async getClassesCache(){let e=await this.db.getObjectDefault(this.deviceKey+"classes",{});return be.isEmpty(e)?this.classes:e}async getFiletObjCache(){let e=await this.db.getObjectDefault(this.deviceKey+"filterObj",{});return be.isEmpty(e)?this.filterObj:e}async home(e,n){return this.vodList=[],await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u7C7B\u522B",!0),await this.setHome(),await this.jadeLog.debug(`\u9996\u9875\u7C7B\u522B\u5185\u5BB9\u4E3A:${this.result.home(this.classes,[],this.filterObj)}`),await this.jadeLog.info("\u9996\u9875\u7C7B\u522B\u89E3\u6790\u5B8C\u6210",!0),this.result.home(this.classes,[],this.filterObj)}async homeVod(){await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u5185\u5BB9",!0);try{return await this.setHomeVod(),await this.jadeLog.debug(`\u9996\u9875\u5185\u5BB9\u4E3A:${this.result.homeVod(this.homeVodList)}`),await this.jadeLog.info("\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5B8C\u6210",!0),this.result.homeVod(this.homeVodList)}catch(e){await this.jadeLog.error(`\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${e}`)}}async category(e,n){let r=e.body.id,l=e.body.page,i=!0,s=e.body.filters;if(this.page=parseInt(l),await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u5206\u7C7B\u9875\u9762,tid = ${r},pg = ${l},extend = ${JSON.stringify(s)}`),r==="\u6700\u8FD1\u66F4\u65B0")return this.page=0,await this.homeVod();try{return this.vodList=[],await this.setCategory(r,l,i,s),await this.jadeLog.debug(`\u5206\u7C7B\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}`),await this.jadeLog.info("\u5206\u7C7B\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}catch(a){await this.jadeLog.error(`\u5206\u7C7B\u9875\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${a}`)}}async detail(e,n){await this.jadeLog.debug(`\u83B7\u53D6\u8BE6\u60C5\u9875\u9762:${JSON.stringify(e.body)}`);let l=(Array.isArray(e.body.id)?e.body.id:[e.body.id])[0];this.vodDetail=new yn,await this.jadeLog.info(`\u6B63\u5728\u83B7\u53D6\u8BE6\u60C5\u9875\u9762,id\u4E3A:${l}`);try{return await this.setDetail(l),await this.jadeLog.debug(`\u8BE6\u60C5\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.detail(this.vodDetail)}`),await this.jadeLog.info("\u8BE6\u60C5\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.vodDetail.vod_id=l,this.result.detail(this.vodDetail)}catch(i){await this.jadeLog.error("\u8BE6\u60C5\u754C\u9762\u83B7\u53D6\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+i)}}async play(e,n){let r=e.body.flag,l=e.body.id,i=[];await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u64AD\u653E\u9875\u9762,flag:${r},id:${l},flags:${i}`,!0);try{let s;if(await this.setPlay(r,l,i),this.playUrl.content!==void 0)return this.playUrl;if(await this.jadeLog.debug("\u4E0D\u9700\u8981\u52A0\u8F7D\u5F39\u5E55",!0),this.result.jx===1&&this.playUrl.indexOf(".m3u8")<0){let a=await e.server.messageToDart({action:"sniff",opt:{url:l,timeout:6e4,rule:"http((?!http).){12,}?\\.m3u8?"}});if(a&&a.url){let o={};a.headers&&(a.headers["user-agent"]&&(o["User-Agent"]=a.headers["user-agent"]),a.headers.referer&&(o.Referer=a.headers.referer)),await this.jadeLog.debug(`\u55C5\u63A2\u6210\u529F,\u64AD\u653E\u8FDE\u63A5\u4E3A:${a.url}`),s=JSON.stringify({parse:0,url:a.url,header:a.headers,jx:"0"})}else await this.jadeLog.error("\u89E3\u6790\u5931\u8D25,\u65E0\u6CD5\u55C5\u63A2\u5230\u64AD\u653E\u8FDE\u63A5"),s=JSON.stringify({parse:0,url:"",jx:"0"})}else s=this.result.play(this.playUrl);return await this.jadeLog.info("\u64AD\u653E\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),await this.jadeLog.debug(`\u64AD\u653E\u9875\u9762\u5185\u5BB9\u4E3A:${s}`),s}catch(s){await this.jadeLog.error("\u89E3\u6790\u64AD\u653E\u9875\u9762\u51FA\u9519,\u5931\u8D25\u539F\u56E0\u4E3A:"+s)}}async search(e,n){let r=e.body.page,l=e.body.wd,i=!0;return this.vodList=[],await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u641C\u7D22\u9875\u9762,\u5173\u952E\u8BCD\u4E3A = ${l},quick = ${i},pg = ${r}`),await this.setSearch(l,i,r),this.vodList.length===0&&l.indexOf(" ")>-1&&(await this.jadeLog.debug(`\u641C\u7D22\u5173\u952E\u8BCD\u4E3A:${l},\u5176\u4E2D\u6709\u7A7A\u683C,\u53BB\u9664\u7A7A\u683C\u5728\u641C\u7D22\u4E00\u6B21`),await this.search(l.replaceAll(" ","").replaceAll("?",""),i)),await this.jadeLog.debug(`\u641C\u7D22\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.search(this.vodList)}`),await this.jadeLog.info("\u641C\u7D22\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.search(this.vodList)}async proxy(e,n){try{let r=e.params.what,l={};try{l=JSON.parse(e.params.ids)}catch{}let i=decodeURIComponent(e.params.end),s=JSON.parse(await this.setProxy([r,i],l));return r==="dash"?(await this.jadeLog.debug(`dash:${JSON.stringify(s)}`),n.code(s.code).headers(s.headers),s.content):s.code===200?(n.code(s.code).headers(s.headers),Buffer.from(s.content,"base64")):(n.code(500),"")}catch(r){await this.jadeLog.error(`\u4EE3\u7406\u56DE\u8C03\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}}};function oG(t,{key:e,iv:n}={}){let r="B77A9FF7F323B5404902102257503C2F",l="B77A9FF7F323B5404902102257503C2F";var i=en.enc.Utf8.parse(t),s=en.AES.encrypt(i,en.enc.Utf8.parse(e||r),{iv:en.enc.Utf8.parse(n||l),mode:en.mode.CBC,padding:en.pad.Pkcs7});return en.enc.Base64.stringify(s.ciphertext)}function I_e(){let t=new Date;return oG(parseInt(t.getTime()/1e3)+t.getTimezoneOffset()*60+-1)}function C_e(t){let n=en.enc.Utf8.parse("46cc793c53dc451b"),r=en.AES.decrypt(t,n,{mode:en.mode.ECB,padding:en.pad.Pkcs7});return en.enc.Utf8.stringify(r).toString()}var kb=class extends jn{constructor(){super(),this.siteUrl="https://api.qianyuewenhua.xyz"}async spiderInit(e=null){e!==null?this.jsBase=await js2Proxy(e,"imgBt",this.getHeader()):this.jsBase=await js2Proxy(!0,this.siteType,this.siteKey,"imgBt/",this.getHeader())}async init(e){await super.init(e),this.danmuStaus=!0,await this.spiderInit(null)}getAppName(){return"\u542B\u7F9E\u8349"}getName(){return"\u{1F51E}\u2503\u542B\u7F9E\u8349\u2503\u{1F51E}"}getJSName(){return"hanxiucao"}getType(){return 3}getParams(e){return{endata:oG(JSON.stringify(e)),ents:I_e()}}async setClasses(){let e=this.getParams({channel:"pc"}),n=await this.post(this.siteUrl+"/panel/list",e,this.getHeader(),""),r=JSON.parse(n);for(let l of r.data.list){let i=l.panelId,s=l.panelName;s!=="\u9996\u9875"&&this.classes.push(this.getTypeDic(s,i))}}async getFilter(e){let n=[];for(let r of e){let l=JSON.parse(r.layoutContent);for(let i of l.sortKeys){let s={};i.label!=="\u7EFC\u5408\u6392\u5E8F"?(s={key:"sorts",name:i.label.toString(),value:[]},s.value.push({n:"\u5347\u5E8F",v:i.value.toString()+"-\u5347\u5E8F"}),s.value.push({n:"\u964D\u5E8F",v:i.value.toString()+"-\u964D\u5E8F"})):(s={key:"sorts",name:"\u6392\u5E8F",value:[]},s.value.push({n:i.label.toString(),v:i.value.toString()})),n.push(s)}}return n}async getNvYouFilter(e){let n=[],r={uids:[],page:1,length:20};for(let i=0;i<e.length;i++){let s=e[i],a=JSON.parse(s.layoutContent);r.uids=a.list;let o=JSON.parse(await this.post(this.siteUrl+"/user/getUpList",this.getParams(r),this.getHeader(),"")),c={key:"tags",name:s.layoutName,value:[]};for(let f of o.data.list)c.value.push({n:f.user_nicename,v:JSON.stringify(f)});n.push(c)}let l=[{key:"sorts",name:"\u53D1\u5E03\u65F6\u95F4",value:[{n:"\u5347\u5E8F",v:"1-\u5347\u5E8F"},{n:"\u964D\u5E8F",v:"1-\u964D\u5E8F"}]},{key:"sorts",name:"\u70B9\u8D5E\u6570\u91CF",value:[{n:"\u5347\u5E8F",v:"5-\u5347\u5E8F"},{n:"\u964D\u5E8F",v:"5-\u964D\u5E8F"}]},{key:"sorts",name:"\u6536\u85CF\u6570\u91CF",value:[{n:"\u5347\u5E8F",v:"6-\u5347\u5E8F"},{n:"\u964D\u5E8F",v:"6-\u964D\u5E8F"}]}];return[...n,...l]}async getZhuanTiFilter(e){let n=[],r={page:1,length:36,subjectIds:[]};for(let i=0;i<e.length;i++){let s=e[i],a=JSON.parse(s.layoutContent);r.subjectIds=a.list;let o=JSON.parse(await this.post(this.siteUrl+"/subject/list",this.getParams(r),this.getHeader(),"")),c={key:"tags",name:s.layoutName,value:[]};for(let f of o.data.list)c.value.push({n:f.name,v:JSON.stringify(f)});n.push(c)}let l={key:"sorts",name:"\u6392\u5E8F",value:[{n:"\u63A8\u8350",v:"8"},{n:"\u6700\u65B0",v:"1"},{n:"\u6700\u70ED",v:"2"}]};return n.push(l),n}async getChuanMeiFilter(e){let n=[],r={key:"tags",name:"\u4F20\u5A92",value:[]};for(let l=0;l<e.length;l++){let i=e[l];r.value.push({n:i.layoutName,v:i.layoutContent})}n.push(r);for(let l of JSON.parse(e[0].layoutContent).moreOrderType)r={key:"sorts",name:l.label.toString(),value:[]},r.value.push({n:"\u5347\u5E8F",v:l.value.toString()+"-\u5347\u5E8F"}),r.value.push({n:"\u964D\u5E8F",v:l.value.toString()+"-\u964D\u5E8F"}),n.push(r);return n.push(r),n}async getHeJiFilter(e){let n=[],r={page:1,length:24,gatherType:1,gatherIds:[]},l={key:"tags",name:"\u5408\u96C6",value:[]},i=JSON.parse(await this.post(this.siteUrl+"/gather/getList",this.getParams(r),this.getHeader(),""));for(let s of i.data.list)l.value.push({n:s.name,v:s.gatherId.toString()});return n.push(l),n}async setFilterObj(){for(let e=0;e<this.classes.length;e++){let n=this.classes[e],r=n.type_id,l=n.type_name,i=[];if(r!=="\u6700\u8FD1\u66F4\u65B0"){r=parseInt(r);let s=this.getParams({panelId:r}),a=await this.post(this.siteUrl+"/panel/get",s,this.getHeader(),""),o=JSON.parse(a),c=o.data.info.Layouts,f=JSON.parse(o.data.info.Layouts[0].layoutContent);if(r>174&&r<181){let p=JSON.parse(o.data.info.Layouts[0].layoutContent);r=r+"$"+JSON.stringify(p),i=await this.getFilter(c)}else switch(r){case 172:i=await this.getHeJiFilter(c),r=r+"$"+i[0].value[0].v;break;case 173:i=await this.getChuanMeiFilter(c),r=r+"$"+JSON.stringify(f);break;case 182:i=await this.getNvYouFilter(c),r=r+"$"+i[0].value[0].v;break;case 209:i=await this.getZhuanTiFilter(c),r=r+"$"+i[0].value[0].v;break;default:break}this.classes[e]=this.getTypeDic(l,r),this.filterObj[r]=i}}}async parseVodShortListFromJson(e){let n=[];for(let r of e){let l=new ln;l.vod_id=r.id,l.vod_name=r.name,l.vod_pic=this.jsBase+R3(r.coverImgUrl),r.hot===void 0?l.vod_remarks="\u89C2\u770B:"+(r.seeCount/1e4).toFixed(1).toString()+"W":l.vod_remarks="\u70ED\u5EA6:"+(r.hot/1e3).toFixed(1).toString()+"K",n.push(l)}return n}async parseVodShortListFromGatherJson(e){let n=[];for(let r of e){let l=new ln;l.vod_id=r.gatherId,l.vod_name=r.name,l.vod_pic=this.jsBase+R3(r.coverImgUrl),n.push(l)}return n}async parseVodDetailFromDoc(e){let n=new yn;n.vod_name=e.name,n.vod_year=e.addTime,n.vod_pic=this.jsBase+R3(e.coverImgUrl),n.type_name=e.typeName,n.vod_content=e.tags;let r=[],l={videoId:e.id},s=JSON.parse(await this.post(this.siteUrl+"/videos/getPreUrl",this.getParams(l),this.getHeader(),"")).data.url.split("?"),a=s[0]+"?sign"+s[1].split("&sign").slice(-1)[0];r.push(n.vod_name+"$"+a);let o={\u7EBF\u8DEF1:r.join("#")};return n.vod_play_url=be.values(o).join("$$$"),n.vod_play_from=be.keys(o).join("$$$"),n}async getHomeVod(e){let n=this.getParams(e),r=await this.post(this.siteUrl+"/videos/getList",n,this.getHeader(),"");return await this.parseVodShortListFromJson(JSON.parse(r).data.list)}async setHomeVod(){let e=await this.getHomeVod({page:1,length:16,offset:0,typeIds:[],orderType:1,payType:[3,4]}),n=await this.getHomeVod({page:1,length:16,offset:0,typeIds:[],orderType:3,payType:[1]}),r=await this.getHomeVod({page:1,length:32,offset:0,typeIds:[],orderType:1,payType:[3]});this.homeVodList=[...e,...n,...r]}getSortParams(e,n){let r=n.sorts??"";if(!be.isEmpty(r)){let l=r.split("-")[0];e.orderType=parseInt(l);let i=r.split("-")[1],s=0;i==="\u5347\u5E8F"?s="1":s="0",e.orderMode=parseInt(s)}return e}getTopParams(e,n,r,l){let i;e===180?i="1":i="7";let s="1",a,o=l.sorts??i,c=!1;o.indexOf("-")>-1?(a=o.split("-")[0],o.split("-")[1]==="\u5347\u5E8F"?s="1":s="0",c=!0):a=i;let f={orderType:parseInt(a),tags:[],length:11,page:parseInt(r),typeIds:n.classs,payType:n.payType};return c&&(f.orderMode=parseInt(s)),f}getChuanMeiParams(e,n,r){let l;be.isEmpty(r.tags)?l=e:l=JSON.parse(r.tags);let i={page:parseInt(n),length:32,offset:32*parseInt(n-1),tag:l.videoLables.join(","),typeIds:l.classs,orderType:l.orderType,payType:l.payType};return i=this.getSortParams(i,r),i}getNvYouParams(e,n,r){let l;be.isEmpty(r.tags)?l=e:l=JSON.parse(r.tags);let i={videoSort:1,touid:l.id,page:parseInt(n),length:12,orderType:1};return i=this.getSortParams(i,r),i}getZhuantiParams(e,n,r){let l;be.isEmpty(r.tags)?l=e:l=JSON.parse(r.tags);let i=r.sorts??"8";return{page:parseInt(n),length:12,offset:12*(parseInt(n)-1),orderType:parseInt(i),subjectId:l.id}}async setCategory(e,n,r,l){let i=e.split("$"),s=parseInt(i[0]),a=JSON.parse(i[1]),o={},c="/videos/getList";if(s>174&&s<181)o=this.getTopParams(s,a,n,l);else switch(s){case 173:o=this.getChuanMeiParams(a,n,l);break;case 182:o=this.getNvYouParams(a,n,l),c="/user/getSpaceVideo";break;case 209:o=this.getZhuantiParams(a,n,l);break;case 172:let p=l.tags??a;o={gatherId:parseInt(p)},c="/gather/getDetail";break;default:break}let f=JSON.parse(await this.post(this.siteUrl+c,this.getParams(o),this.getHeader(),""));s===172?this.vodList=await this.parseVodShortListFromJson(f.data.info.videos):this.vodList=await this.parseVodShortListFromJson(f.data.list)}async setDetail(e){let n={videoId:parseInt(e),videoSort:1},r=JSON.parse(await this.post(this.siteUrl+"/videos/getInfo",this.getParams(n),this.getHeader(),""));this.vodDetail=await this.parseVodDetailFromDoc(r.data.info)}async proxy(e,n){let r=e[0],l=R2(e[1]);if(r==="imgBt"){let i=await req(l,{buffer:0});return JSON.stringify({code:200,buffer:2,content:C_e(i.content).replaceAll("data:image/jpeg;base64,","").replaceAll("data:image/jpg;base64,","").replaceAll("data:image/png;base64",""),headers:n})}}async setSearch(e,n,r){let l={page:parseInt(r),length:12,type:1,key:e},i=JSON.parse(await this.post(this.siteUrl+"/base/globalSearch",this.getParams(l),this.getHeader(),""));this.vodList=await this.parseVodShortListFromJson(i.data.infos),this.result.setPage(parseInt(r),i.data.count/12,12,i.data.count)}},sn=new kb;var Pb=class extends kn{constructor(){super()}getName(){return sn.getName()}getAppName(){return sn.getAppName()}getJSName(){return sn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await sn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await sn.initCookie(e.server.config.bilicookie),await sn.spiderInit(e),sn.cfgObj.code=0,sn.catOpenStatus=!0,sn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await sn.setClasses(),this.classes=sn.classes}async setFilterObj(){await sn.setFilterObj(),this.filterObj=sn.filterObj}async setHomeVod(){await sn.setHomeVod(),this.homeVodList=sn.homeVodList}async setCategory(e,n,r,l){await sn.setCategory(e,n,r,l),this.vodList=sn.vodList}async setDetail(e){await sn.setDetail(e),this.vodDetail=sn.vodDetail}async setPlay(e,n,r){await sn.setPlay(e,n,r),this.playUrl=sn.playUrl,this.result=sn.result}async setSearch(e,n,r){await sn.setSearch(e,n,r),this.vodList=sn.vodList,this.result=sn.result}async setProxy(e,n){return await sn.proxy(e,n)}},Is=new Pb;async function uG(t,e){return await Is.init(t,e)}async function cG(t,e){return await Is.home(t,e)}async function k_e(t,e){return await Is.homeVod(t,e)}async function fG(t,e){return await Is.category(t,e)}async function pG(t,e){return await Is.detail(t,e)}async function dG(t,e){return await Is.play(t,e)}async function hG(t,e){return await Is.search(t,e)}async function P_e(t,e){return await Is.proxy(t,e)}var mG={meta:{key:sn.getJSName(),name:sn.getName(),type:sn.getType()},api:async t=>{t.post("/init",uG),t.post("/home",cG),t.post("/category",fG),t.post("/detail",pG),t.post("/play",dG),t.post("/search",hG),t.get("/proxy/:what/:ids/:end",P_e)},spider:{init:uG,home:cG,homeVod:k_e,category:fG,detail:pG,play:dG,search:hG}};var N4=class extends jn{constructor(){super(),this.siteUrl="http://cj.ffzyapi.com",this.remove18=!1,this.type_id_18=34}async spiderInit(e){e!==null?this.detailProxy=await js2Proxy(e,"detail",this.getHeader()):this.detailProxy=await js2Proxy(!0,this.siteType,this.siteKey,"detail/",this.getHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async parseVodShortListFromJson(e,n=!1){let r=[],l;for(let i of e.list)n?(l=new ln,l.vod_pic=this.detailProxy+R3(i.vod_id),l.vod_id=i.vod_id,l.vod_name=i.vod_name,l.vod_remarks=i.vod_remarks):l=this.parseVodDetail(i),this.remove18&&i.type_id!==this.type_id_18&&r.push(l),!this.remove18&&i.type_id===this.type_id_18&&r.push(l);return r}parseVodDetail(e){let n=new yn;n.vod_id=e.vod_id,n.vod_name=e.vod_name,n.vod_pic=e.vod_pic,n.vod_remarks=e.vod_remarks,n.vod_area=e.vod_area,n.vod_year=e.vod_year,n.vod_actor=e.vod_actor,n.vod_director=e.vod_director;let r=Sr(e.vod_content);return n.vod_content=r.text(),e.vod_down_url!==void 0&&e.vod_down_url.length>0&&(n.vod_play_from="\u76F4\u94FE\u64AD\u653E$$$",n.vod_play_url=e.vod_down_url+"$$$"),n.vod_play_from=n.vod_play_from+e.vod_play_from,n.vod_play_url=n.vod_play_url+e.vod_play_url,n.type_name=e.type_name,n}async parseVodDetailfromJson(e){let n,r=e.list;if(r.length>0){let l=r[0];n=this.parseVodDetail(l)}return n}async setClasses(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of n.class)r.type_pid!==0&&this.classes.push(this.getTypeDic(r.type_name,r.type_id))}async setFilterObj(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of this.classes){let l=r.type_id.toString();if(l!=="\u6700\u8FD1\u66F4\u65B0"){let i={key:"1",name:"\u5206\u7C7B",value:[{n:"\u5168\u90E8",v:l}]};for(let s of n.class){let a=s.type_name;a===this.type_name_18&&(this.type_id_18=s.type_id.toString()),this.remove18?s.type_pid===r.type_id&&a!==this.type_name_18&&i.value.push({n:a,v:s.type_id.toString()}):s.type_pid===r.type_id&&a===this.type_name_18&&i.value.push({n:a,v:s.type_id.toString()})}this.remove18?this.filterObj[l]=[i]:this.classes=[this.getTypeDic("\u6700\u8FD1\u66F4\u65B0","\u6700\u8FD1\u66F4\u65B0"),this.getTypeDic(this.type_name_18,this.type_id_18)]}}}async setHomeVod(){let e=await this.fetch(this.siteUrl+"/index.php/ajax/data",{mid:"1"},this.getHeader());this.homeVodList=await this.parseVodShortListFromJson(JSON.parse(e))}async setDetail(e){let n=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:e},this.getHeader());this.vodDetail=await this.parseVodDetailfromJson(JSON.parse(n))}async setCategory(e,n,r,l){e=l[1]??e;let i=this.siteUrl+`/index.php/ajax/data?mid=1&tid=${e}&page=${n}&limit=20`;await this.jadeLog.debug(`\u5206\u7C7BURL:${i}`);let s=await this.fetch(i,null,this.getHeader());await this.jadeLog.debug(`\u5206\u7C7B\u5185\u5BB9\u4E3A:${s}`),this.vodList=await this.parseVodShortListFromJson(JSON.parse(s))}async setSearch(e,n){let r=await this.fetch(this.siteUrl+"/api.php/provide/vod/",{wd:e},this.getHeader());this.vodList=await this.parseVodShortListFromJson(JSON.parse(r),!0)}async proxy(e,n){await this.jadeLog.debug(`\u6B63\u5728\u8BBE\u7F6E\u53CD\u5411\u4EE3\u7406 segments = ${e.join(",")},headers = ${JSON.stringify(n)}`);let r=e[0],l=R2(e[1]);if(await this.jadeLog.debug(`\u53CD\u5411\u4EE3\u7406\u53C2\u6570\u4E3A:${l}`),r==="detail"){let i=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:l},this.getHeader()),s=await this.parseVodDetailfromJson(JSON.parse(i)),a=await this.fetch(s.vod_pic,null,this.getHeader(),!1,!1,2);return be.isEmpty(a)?JSON.stringify({code:500,buffer:2,content:"",headers:{}}):JSON.stringify({code:200,buffer:2,content:a,headers:{}})}}};var Db=class extends N4{constructor(){super(),this.siteUrl="https://cj.lzcaiji.com",this.remove18=!1}getAppName(){return"\u91CF\u5B50\u8D44\u6E9018+"}getName(){return"\u{1F51E}\u2503\u91CF\u5B50\u8D44\u6E9018+\u2503\u{1F51E}"}getJSName(){return"liangzi18"}getType(){return 3}async spiderInit(e){await super.spiderInit(e)}async init(e){await super.init(e),await this.spiderInit(null)}},an=new Db;var Lb=class extends kn{constructor(){super()}getName(){return an.getName()}getAppName(){return an.getAppName()}getJSName(){return an.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await an.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await an.initCookie(e.server.config.bilicookie),await an.spiderInit(e),an.cfgObj.code=0,an.catOpenStatus=!0,an.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await an.setClasses(),this.classes=an.classes}async setFilterObj(){await an.setFilterObj(),this.filterObj=an.filterObj}async setHomeVod(){await an.setHomeVod(),this.homeVodList=an.homeVodList}async setCategory(e,n,r,l){await an.setCategory(e,n,r,l),this.vodList=an.vodList}async setDetail(e){await an.setDetail(e),this.vodDetail=an.vodDetail}async setPlay(e,n,r){await an.setPlay(e,n,r),this.playUrl=an.playUrl,this.result=an.result}async setSearch(e,n,r){await an.setSearch(e,n,r),this.vodList=an.vodList,this.result=an.result}async setProxy(e,n){return await an.proxy(e,n)}},Cs=new Lb;async function gG(t,e){return await Cs.init(t,e)}async function yG(t,e){return await Cs.home(t,e)}async function D_e(t,e){return await Cs.homeVod(t,e)}async function vG(t,e){return await Cs.category(t,e)}async function _G(t,e){return await Cs.detail(t,e)}async function EG(t,e){return await Cs.play(t,e)}async function bG(t,e){return await Cs.search(t,e)}async function L_e(t,e){return await Cs.proxy(t,e)}var TG={meta:{key:an.getJSName(),name:an.getName(),type:an.getType()},api:async t=>{t.post("/init",gG),t.post("/home",yG),t.post("/category",vG),t.post("/detail",_G),t.post("/play",EG),t.post("/search",bG),t.get("/proxy/:what/:ids/:end",L_e)},spider:{init:gG,home:yG,homeVod:D_e,category:vG,detail:_G,play:EG,search:bG}};var Fb=class extends jn{constructor(){super(),this.siteUrl="https://hongkongdollvideo.com"}getImgHeader(){let e=this.getHeader();return e.Proxy=!0,e}async spiderInit(e=null){e!==null?this.jsBase=await js2Proxy(e,"img",this.getImgHeader()):this.jsBase=await js2Proxy(!0,this.siteType,this.siteKey,"img/",this.getImgHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async getHtml(e=this.siteUrl,n=!1,r=this.getHeader()){return super.getHtml(e,!0,r)}getName(){return"\u{1F51E}\u2503\u73A9\u5076\u59D0\u59D0\u2503\u{1F51E}"}getAppName(){return"\u73A9\u5076\u59D0\u59D0"}getJSName(){return"doll"}getType(){return 3}async parseVodShortListFromDoc(e){let n=[],r=e('[class="row"]').find('[class="video-detail"]');for(let l of r){let i=new ln;i.vod_id=e(l).find("a")[0].attribs.href;let s=e(e(l).find('[class="video-info"]')).find("a");i.vod_name=s[0].attribs.title,i.vod_remarks=e(s[1]).text();let a=e(l).find("img")[0].attribs["data-src"];i.vod_pic=a,n.push(i)}return n}async parseVodDetailFromDoc(e,n){let r=new yn,l=e('[class="container-fluid"]');r.vod_name=e(e(l).find('[class="page-title"]')[0]).text(),r.vod_remarks=e(l).find('[class="tag my-1 text-center"]')[0].attribs.href.replaceAll("/","");let i=e(l).find("video")[0].attribs.poster;r.vod_pic=i;let s=e.html(),a=Qr(/var voteTag="(.*?)";/g,s);a=en.enc.Utf8.stringify(en.enc.Base64.parse(a));let o=[];for(let f=0;f<a.length;f++){let p=f%n.length;o.push(String.fromCharCode(a.charCodeAt(f)^n.charCodeAt(p)))}let c=decodeURIComponent(en.enc.Utf8.stringify(en.enc.Base64.parse(o.join(""))));return r.vod_play_from="\u73A9\u5076\u59D0\u59D0",r.vod_play_url="\u73A9\u5076\u59D0\u59D0$"+c,r}async setClasses(){let e=await this.getHtml(this.siteUrl),n=e('[class="list-unstyled topnav-menu d-flex d-lg-block align-items-center justify-content-center flex-fill topnav-menu-left m-0"]').find("li"),r=1,l=r.toString();this.classes=[],this.classes.push({type_name:"\u9996\u9875",type_id:"1"}),this.filterObj[l]=[];for(let s of n){let a=e(s).text().split(`
`+t)}globalThis.req=R_e;async function R_e(t,e){try{let n=e&&e.data||null,r=e&&e.postType||null,l=e&&e.buffer||0,i=e&&e.timeout||5e3,s=(e&&e.redirect||1)===1,a=e.proxy??!1,o=e?e.headers||{}:{};r==="form"?(o["Content-Type"]="application/x-www-form-urlencoded",n!=null&&(n=lG.default.stringify(n,{encode:!1}))):r==="form-data"&&(o["Content-Type"]="multipart/form-data",n=Jz(n));let c=l===1||l===2?"arraybuffer":void 0,f;a?f=aG.default.httpsOverHttp({proxy:{host:"127.0.0.1",port:7890}}):f=iG.default.Agent({rejectUnauthorized:!1});let p=await w4(t,{responseType:c,method:e&&e.method||"get",headers:o,data:n,timeout:i,maxRedirects:s?null:0,httpsAgent:f});n=p.data;let m={};for(let h of p.headers){let g=h[1];m[h[0]]=Array.isArray(g)&&g.length===1?g[0]:g}if(!l)typeof n=="object"&&(n=JSON.stringify(n));else{if(l===1)return{code:p.status,headers:m,content:n};if(l===2)return{code:p.status,headers:m,content:n.toString("base64")};if(l===3){let h=e.stream;return h.onResp&&await h.onResp({code:p.status,headers:m}),h.onData?(n.on("data",async g=>{await h.onData(g)}),n.on("end",async()=>{h.onDone&&await h.onDone()})):h.onDone&&await h.onDone(),"stream..."}}return{code:p.status,headers:m,content:n}}catch(n){let r=n.response;try{return{code:r.status,headers:r.headers,content:JSON.stringify(r.data)}}catch{return{headers:{},content:""}}}}globalThis.md5X=O_e;function O_e(t){return sG.default.createHash("md5").update(Buffer.from(t,"utf8")).digest("hex")}globalThis.js2Proxy=function(t,e,n){let r=Object.keys(n).length===0?" ":encodeURIComponent(JSON.stringify(n));return t.server.address().dynamic+t.server.prefix+"/proxy/"+encodeURIComponent(e)+"/"+r+"/"};var N_e=["DEBUG","INFO","WARNING","ERROR"];var O4=class{constructor(e,n="DEBUG"){this.app_name=e,this.level=n,this.level_index=N_e.indexOf(n)}format(e,n){let r=80;switch(e){case"INFO":r=r+1;break;case"WARNING":r=r-2;break;default:break}return n.length<r&&((r-n.length)%2===0?n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)):n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)+1)),n}getTime(){let e=new Date;return e.toLocaleDateString().replace(/\//g,"-")+" "+e.toTimeString().substr(0,8)+","+e.getMilliseconds().toString()}formatMessage(e,n,r){return r&&(n=this.format(e,n)),`${this.getTime()} - ${this.app_name} - ${e}: ${n}`}async log(e){console.debug(e),await req("http://127.0.0.1:8099/upload",{data:{log:e+`
`},timeout:.1})}async info(e,n){this.level_index<=1&&await this.log(this.formatMessage("INFO",e,n))}async warning(e,n){this.level_index<=2&&await this.log(this.formatMessage("WARNING",e,n))}async error(e,n){this.level_index<=3&&await this.log(this.formatMessage("ERROR",e,n))}async debug(e,n){this.level_index<=0&&await this.log(this.formatMessage("DEBUG",e,n))}};var kn=class extends jn{constructor(){super(),this.jadeLog=new O4(this.getAppName(),"DEBUG")}async init(e,n){await this.jadeLog.info("\u521D\u59CB\u5316",!0);try{await await req("http://127.0.0.1:8099/clear",{timeout:.1}),this.siteKey=this.getJSName(),this.siteType=this.getType(),this.cfgObj=e.server.config[this.siteKey],this.deviceKey=e.server.prefix+"/",this.db=e.server.db,this.catOpenStatus=!0,this.danmuStaus=!1;try{await this.loadFilterAndClasses()?await this.jadeLog.debug("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u6210\u529F"):(await this.jadeLog.warning("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u5931\u8D25"),await this.writeFilterAndClasses())}catch(r){await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),await this.jadeLog.error("\u8BFB\u53D6\u7F13\u5B58\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+r,!1)}}catch(r){await this.jadeLog.error(`\u521D\u59CB\u5316\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}await this.jadeLog.info("\u521D\u59CB\u5316\u5B8C\u6210",!0)}async loadFilterAndClasses(){return this.classes=await this.getClassesCache(),this.filterObj=await this.getFiletObjCache(),this.classes.length>0?!0:(await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),!1)}async writeFilterAndClasses(){this.catOpenStatus&&this.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await this.setClasses(),await this.setFilterObj(),await this.db.push(this.deviceKey+"classes",this.classes),await this.db.push(this.deviceKey+"filterObj",this.filterObj)}async getClassesCache(){let e=await this.db.getObjectDefault(this.deviceKey+"classes",{});return be.isEmpty(e)?this.classes:e}async getFiletObjCache(){let e=await this.db.getObjectDefault(this.deviceKey+"filterObj",{});return be.isEmpty(e)?this.filterObj:e}async home(e,n){return this.vodList=[],await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u7C7B\u522B",!0),await this.setHome(),await this.jadeLog.debug(`\u9996\u9875\u7C7B\u522B\u5185\u5BB9\u4E3A:${this.result.home(this.classes,[],this.filterObj)}`),await this.jadeLog.info("\u9996\u9875\u7C7B\u522B\u89E3\u6790\u5B8C\u6210",!0),this.result.home(this.classes,[],this.filterObj)}async homeVod(){await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u5185\u5BB9",!0);try{return await this.setHomeVod(),await this.jadeLog.debug(`\u9996\u9875\u5185\u5BB9\u4E3A:${this.result.homeVod(this.homeVodList)}`),await this.jadeLog.info("\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5B8C\u6210",!0),this.result.homeVod(this.homeVodList)}catch(e){await this.jadeLog.error(`\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${e}`)}}async category(e,n){let r=e.body.id,l=e.body.page,i=!0,s=e.body.filters;if(this.page=parseInt(l),await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u5206\u7C7B\u9875\u9762,tid = ${r},pg = ${l},extend = ${JSON.stringify(s)}`),r==="\u6700\u8FD1\u66F4\u65B0")return this.page=0,await this.homeVod();try{return this.vodList=[],await this.setCategory(r,l,i,s),await this.jadeLog.debug(`\u5206\u7C7B\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}`),await this.jadeLog.info("\u5206\u7C7B\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}catch(a){await this.jadeLog.error(`\u5206\u7C7B\u9875\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${a}`)}}async detail(e,n){await this.jadeLog.debug(`\u83B7\u53D6\u8BE6\u60C5\u9875\u9762:${JSON.stringify(e.body)}`);let l=(Array.isArray(e.body.id)?e.body.id:[e.body.id])[0];this.vodDetail=new yn,await this.jadeLog.info(`\u6B63\u5728\u83B7\u53D6\u8BE6\u60C5\u9875\u9762,id\u4E3A:${l}`);try{return await this.setDetail(l),await this.jadeLog.debug(`\u8BE6\u60C5\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.detail(this.vodDetail)}`),await this.jadeLog.info("\u8BE6\u60C5\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.vodDetail.vod_id=l,this.result.detail(this.vodDetail)}catch(i){await this.jadeLog.error("\u8BE6\u60C5\u754C\u9762\u83B7\u53D6\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+i)}}async play(e,n){let r=e.body.flag,l=e.body.id,i=[];await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u64AD\u653E\u9875\u9762,flag:${r},id:${l},flags:${i}`,!0);try{let s;if(await this.setPlay(r,l,i),this.playUrl.content!==void 0)return this.playUrl;if(await this.jadeLog.debug("\u4E0D\u9700\u8981\u52A0\u8F7D\u5F39\u5E55",!0),this.result.jx===1&&this.playUrl.indexOf(".m3u8")<0){let a=await e.server.messageToDart({action:"sniff",opt:{url:l,timeout:6e4,rule:"http((?!http).){12,}?\\.m3u8?"}});if(a&&a.url){let o={};a.headers&&(a.headers["user-agent"]&&(o["User-Agent"]=a.headers["user-agent"]),a.headers.referer&&(o.Referer=a.headers.referer)),await this.jadeLog.debug(`\u55C5\u63A2\u6210\u529F,\u64AD\u653E\u8FDE\u63A5\u4E3A:${a.url}`),s=JSON.stringify({parse:0,url:a.url,header:a.headers,jx:"0"})}else await this.jadeLog.error("\u89E3\u6790\u5931\u8D25,\u65E0\u6CD5\u55C5\u63A2\u5230\u64AD\u653E\u8FDE\u63A5"),s=JSON.stringify({parse:0,url:"",jx:"0"})}else s=this.result.play(this.playUrl);return await this.jadeLog.info("\u64AD\u653E\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),await this.jadeLog.debug(`\u64AD\u653E\u9875\u9762\u5185\u5BB9\u4E3A:${s}`),s}catch(s){await this.jadeLog.error("\u89E3\u6790\u64AD\u653E\u9875\u9762\u51FA\u9519,\u5931\u8D25\u539F\u56E0\u4E3A:"+s)}}async search(e,n){let r=e.body.page,l=e.body.wd,i=!0;return this.vodList=[],await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u641C\u7D22\u9875\u9762,\u5173\u952E\u8BCD\u4E3A = ${l},quick = ${i},pg = ${r}`),await this.setSearch(l,i,r),this.vodList.length===0&&l.indexOf(" ")>-1&&(await this.jadeLog.debug(`\u641C\u7D22\u5173\u952E\u8BCD\u4E3A:${l},\u5176\u4E2D\u6709\u7A7A\u683C,\u53BB\u9664\u7A7A\u683C\u5728\u641C\u7D22\u4E00\u6B21`),await this.search(l.replaceAll(" ","").replaceAll("?",""),i)),await this.jadeLog.debug(`\u641C\u7D22\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.search(this.vodList)}`),await this.jadeLog.info("\u641C\u7D22\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.search(this.vodList)}async proxy(e,n){try{let r=e.params.what,l={};try{l=JSON.parse(e.params.ids)}catch{}let i=decodeURIComponent(e.params.end),s=JSON.parse(await this.setProxy([r,i],l));return r==="dash"?(await this.jadeLog.debug(`dash:${JSON.stringify(s)}`),n.code(s.code).headers(s.headers),s.content):s.code===200?(n.code(s.code).headers(s.headers),Buffer.from(s.content,"base64")):(n.code(500),"")}catch(r){await this.jadeLog.error(`\u4EE3\u7406\u56DE\u8C03\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}}};function oG(t,{key:e,iv:n}={}){let r="B77A9FF7F323B5404902102257503C2F",l="B77A9FF7F323B5404902102257503C2F";var i=en.enc.Utf8.parse(t),s=en.AES.encrypt(i,en.enc.Utf8.parse(e||r),{iv:en.enc.Utf8.parse(n||l),mode:en.mode.CBC,padding:en.pad.Pkcs7});return en.enc.Base64.stringify(s.ciphertext)}function I_e(){let t=new Date;return oG(parseInt(t.getTime()/1e3)+t.getTimezoneOffset()*60+-1)}function C_e(t){let n=en.enc.Utf8.parse("46cc793c53dc451b"),r=en.AES.decrypt(t,n,{mode:en.mode.ECB,padding:en.pad.Pkcs7});return en.enc.Utf8.stringify(r).toString()}var kb=class extends jn{constructor(){super(),this.siteUrl="https://api.qianyuewenhua.xyz"}async spiderInit(e=null){e!==null?this.jsBase=await js2Proxy(e,"imgBt",this.getHeader()):this.jsBase=await js2Proxy(!0,this.siteType,this.siteKey,"imgBt/",this.getHeader())}async init(e){await super.init(e),this.danmuStaus=!0,await this.spiderInit(null)}getAppName(){return"\u542B\u7F9E\u8349"}getName(){return"\u{1F51E}\u2503\u542B\u7F9E\u8349\u2503\u{1F51E}"}getJSName(){return"hanxiucao"}getType(){return 3}getParams(e){return{endata:oG(JSON.stringify(e)),ents:I_e()}}async setClasses(){let e=this.getParams({channel:"pc"}),n=await this.post(this.siteUrl+"/panel/list",e,this.getHeader(),""),r=JSON.parse(n);for(let l of r.data.list){let i=l.panelId,s=l.panelName;s!=="\u9996\u9875"&&this.classes.push(this.getTypeDic(s,i))}}async getFilter(e){let n=[];for(let r of e){let l=JSON.parse(r.layoutContent);for(let i of l.sortKeys){let s={};i.label!=="\u7EFC\u5408\u6392\u5E8F"?(s={key:"sorts",name:i.label.toString(),value:[]},s.value.push({n:"\u5347\u5E8F",v:i.value.toString()+"-\u5347\u5E8F"}),s.value.push({n:"\u964D\u5E8F",v:i.value.toString()+"-\u964D\u5E8F"})):(s={key:"sorts",name:"\u6392\u5E8F",value:[]},s.value.push({n:i.label.toString(),v:i.value.toString()})),n.push(s)}}return n}async getNvYouFilter(e){let n=[],r={uids:[],page:1,length:20};for(let i=0;i<e.length;i++){let s=e[i],a=JSON.parse(s.layoutContent);r.uids=a.list;let o=JSON.parse(await this.post(this.siteUrl+"/user/getUpList",this.getParams(r),this.getHeader(),"")),c={key:"tags",name:s.layoutName,value:[]};for(let f of o.data.list)c.value.push({n:f.user_nicename,v:JSON.stringify(f)});n.push(c)}let l=[{key:"sorts",name:"\u53D1\u5E03\u65F6\u95F4",value:[{n:"\u5347\u5E8F",v:"1-\u5347\u5E8F"},{n:"\u964D\u5E8F",v:"1-\u964D\u5E8F"}]},{key:"sorts",name:"\u70B9\u8D5E\u6570\u91CF",value:[{n:"\u5347\u5E8F",v:"5-\u5347\u5E8F"},{n:"\u964D\u5E8F",v:"5-\u964D\u5E8F"}]},{key:"sorts",name:"\u6536\u85CF\u6570\u91CF",value:[{n:"\u5347\u5E8F",v:"6-\u5347\u5E8F"},{n:"\u964D\u5E8F",v:"6-\u964D\u5E8F"}]}];return[...n,...l]}async getZhuanTiFilter(e){let n=[],r={page:1,length:36,subjectIds:[]};for(let i=0;i<e.length;i++){let s=e[i],a=JSON.parse(s.layoutContent);r.subjectIds=a.list;let o=JSON.parse(await this.post(this.siteUrl+"/subject/list",this.getParams(r),this.getHeader(),"")),c={key:"tags",name:s.layoutName,value:[]};for(let f of o.data.list)c.value.push({n:f.name,v:JSON.stringify(f)});n.push(c)}let l={key:"sorts",name:"\u6392\u5E8F",value:[{n:"\u63A8\u8350",v:"8"},{n:"\u6700\u65B0",v:"1"},{n:"\u6700\u70ED",v:"2"}]};return n.push(l),n}async getChuanMeiFilter(e){let n=[],r={key:"tags",name:"\u4F20\u5A92",value:[]};for(let l=0;l<e.length;l++){let i=e[l];r.value.push({n:i.layoutName,v:i.layoutContent})}n.push(r);for(let l of JSON.parse(e[0].layoutContent).moreOrderType)r={key:"sorts",name:l.label.toString(),value:[]},r.value.push({n:"\u5347\u5E8F",v:l.value.toString()+"-\u5347\u5E8F"}),r.value.push({n:"\u964D\u5E8F",v:l.value.toString()+"-\u964D\u5E8F"}),n.push(r);return n.push(r),n}async getHeJiFilter(e){let n=[],r={page:1,length:24,gatherType:1,gatherIds:[]},l={key:"tags",name:"\u5408\u96C6",value:[]},i=JSON.parse(await this.post(this.siteUrl+"/gather/getList",this.getParams(r),this.getHeader(),""));for(let s of i.data.list)l.value.push({n:s.name,v:s.gatherId.toString()});return n.push(l),n}async setFilterObj(){for(let e=0;e<this.classes.length;e++){let n=this.classes[e],r=n.type_id,l=n.type_name,i=[];if(r!=="\u6700\u8FD1\u66F4\u65B0"){r=parseInt(r);let s=this.getParams({panelId:r}),a=await this.post(this.siteUrl+"/panel/get",s,this.getHeader(),""),o=JSON.parse(a),c=o.data.info.Layouts,f=JSON.parse(o.data.info.Layouts[0].layoutContent);if(r>174&&r<181){let p=JSON.parse(o.data.info.Layouts[0].layoutContent);r=r+"$"+JSON.stringify(p),i=await this.getFilter(c)}else switch(r){case 172:i=await this.getHeJiFilter(c),r=r+"$"+i[0].value[0].v;break;case 173:i=await this.getChuanMeiFilter(c),r=r+"$"+JSON.stringify(f);break;case 182:i=await this.getNvYouFilter(c),r=r+"$"+i[0].value[0].v;break;case 209:i=await this.getZhuanTiFilter(c),r=r+"$"+i[0].value[0].v;break;default:break}this.classes[e]=this.getTypeDic(l,r),this.filterObj[r]=i}}}async parseVodShortListFromJson(e){let n=[];for(let r of e){let l=new ln;l.vod_id=r.id,l.vod_name=r.name,l.vod_pic=this.jsBase+R3(r.coverImgUrl),r.hot===void 0?l.vod_remarks="\u89C2\u770B:"+(r.seeCount/1e4).toFixed(1).toString()+"W":l.vod_remarks="\u70ED\u5EA6:"+(r.hot/1e3).toFixed(1).toString()+"K",n.push(l)}return n}async parseVodShortListFromGatherJson(e){let n=[];for(let r of e){let l=new ln;l.vod_id=r.gatherId,l.vod_name=r.name,l.vod_pic=this.jsBase+R3(r.coverImgUrl),n.push(l)}return n}async parseVodDetailFromDoc(e){let n=new yn;n.vod_name=e.name,n.vod_year=e.addTime,n.vod_pic=this.jsBase+R3(e.coverImgUrl),n.type_name=e.typeName,n.vod_content=e.tags;let r=[],l={videoId:e.id},s=JSON.parse(await this.post(this.siteUrl+"/videos/getPreUrl",this.getParams(l),this.getHeader(),"")).data.url.split("?"),a=s[0]+"?sign"+s[1].split("&sign").slice(-1)[0];r.push(n.vod_name+"$"+a);let o={\u7EBF\u8DEF1:r.join("#")};return n.vod_play_url=be.values(o).join("$$$"),n.vod_play_from=be.keys(o).join("$$$"),n}async getHomeVod(e){let n=this.getParams(e),r=await this.post(this.siteUrl+"/videos/getList",n,this.getHeader(),"");return await this.parseVodShortListFromJson(JSON.parse(r).data.list)}async setHomeVod(){let e=await this.getHomeVod({page:1,length:16,offset:0,typeIds:[],orderType:1,payType:[3,4]}),n=await this.getHomeVod({page:1,length:16,offset:0,typeIds:[],orderType:3,payType:[1]}),r=await this.getHomeVod({page:1,length:32,offset:0,typeIds:[],orderType:1,payType:[3]});this.homeVodList=[...e,...n,...r]}getSortParams(e,n){let r=n.sorts??"";if(!be.isEmpty(r)){let l=r.split("-")[0];e.orderType=parseInt(l);let i=r.split("-")[1],s=0;i==="\u5347\u5E8F"?s="1":s="0",e.orderMode=parseInt(s)}return e}getTopParams(e,n,r,l){let i;e===180?i="1":i="7";let s="1",a,o=l.sorts??i,c=!1;o.indexOf("-")>-1?(a=o.split("-")[0],o.split("-")[1]==="\u5347\u5E8F"?s="1":s="0",c=!0):a=i;let f={orderType:parseInt(a),tags:[],length:11,page:parseInt(r),typeIds:n.classs,payType:n.payType};return c&&(f.orderMode=parseInt(s)),f}getChuanMeiParams(e,n,r){let l;be.isEmpty(r.tags)?l=e:l=JSON.parse(r.tags);let i={page:parseInt(n),length:32,offset:32*parseInt(n-1),tag:l.videoLables.join(","),typeIds:l.classs,orderType:l.orderType,payType:l.payType};return i=this.getSortParams(i,r),i}getNvYouParams(e,n,r){let l;be.isEmpty(r.tags)?l=e:l=JSON.parse(r.tags);let i={videoSort:1,touid:l.id,page:parseInt(n),length:12,orderType:1};return i=this.getSortParams(i,r),i}getZhuantiParams(e,n,r){let l;be.isEmpty(r.tags)?l=e:l=JSON.parse(r.tags);let i=r.sorts??"8";return{page:parseInt(n),length:12,offset:12*(parseInt(n)-1),orderType:parseInt(i),subjectId:l.id}}async setCategory(e,n,r,l){let i=e.split("$"),s=parseInt(i[0]),a=JSON.parse(i[1]),o={},c="/videos/getList";if(s>174&&s<181)o=this.getTopParams(s,a,n,l);else switch(s){case 173:o=this.getChuanMeiParams(a,n,l);break;case 182:o=this.getNvYouParams(a,n,l),c="/user/getSpaceVideo";break;case 209:o=this.getZhuantiParams(a,n,l);break;case 172:let p=l.tags??a;o={gatherId:parseInt(p)},c="/gather/getDetail";break;default:break}let f=JSON.parse(await this.post(this.siteUrl+c,this.getParams(o),this.getHeader(),""));s===172?this.vodList=await this.parseVodShortListFromJson(f.data.info.videos):this.vodList=await this.parseVodShortListFromJson(f.data.list)}async setDetail(e){let n={videoId:parseInt(e),videoSort:1},r=JSON.parse(await this.post(this.siteUrl+"/videos/getInfo",this.getParams(n),this.getHeader(),""));this.vodDetail=await this.parseVodDetailFromDoc(r.data.info)}async proxy(e,n){let r=e[0],l=R2(e[1]);if(r==="imgBt"){let i=await req(l,{buffer:0});return JSON.stringify({code:200,buffer:2,content:C_e(i.content).replaceAll("data:image/jpeg;base64,","").replaceAll("data:image/jpg;base64,","").replaceAll("data:image/png;base64",""),headers:n})}}async setSearch(e,n,r){let l={page:parseInt(r),length:12,type:1,key:e},i=JSON.parse(await this.post(this.siteUrl+"/base/globalSearch",this.getParams(l),this.getHeader(),""));this.vodList=await this.parseVodShortListFromJson(i.data.infos),this.result.setPage(parseInt(r),i.data.count/12,12,i.data.count)}},sn=new kb;var Pb=class extends kn{constructor(){super()}getName(){return sn.getName()}getAppName(){return sn.getAppName()}getJSName(){return sn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await sn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await sn.initCookie(e.server.config.bilicookie),await sn.spiderInit(e),sn.cfgObj.code=0,sn.catOpenStatus=!0,sn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await sn.setClasses(),this.classes=sn.classes}async setFilterObj(){await sn.setFilterObj(),this.filterObj=sn.filterObj}async setHomeVod(){await sn.setHomeVod(),this.homeVodList=sn.homeVodList}async setCategory(e,n,r,l){await sn.setCategory(e,n,r,l),this.vodList=sn.vodList}async setDetail(e){await sn.setDetail(e),this.vodDetail=sn.vodDetail}async setPlay(e,n,r){await sn.setPlay(e,n,r),this.playUrl=sn.playUrl,this.result=sn.result}async setSearch(e,n,r){await sn.setSearch(e,n,r),this.vodList=sn.vodList,this.result=sn.result}async setProxy(e,n){return await sn.proxy(e,n)}},Is=new Pb;async function uG(t,e){return await Is.init(t,e)}async function cG(t,e){return await Is.home(t,e)}async function k_e(t,e){return await Is.homeVod(t,e)}async function fG(t,e){return await Is.category(t,e)}async function pG(t,e){return await Is.detail(t,e)}async function dG(t,e){return await Is.play(t,e)}async function hG(t,e){return await Is.search(t,e)}async function P_e(t,e){return await Is.proxy(t,e)}var mG={meta:{key:sn.getJSName(),name:sn.getName(),type:sn.getType()},api:async t=>{t.post("/init",uG),t.post("/home",cG),t.post("/category",fG),t.post("/detail",pG),t.post("/play",dG),t.post("/search",hG),t.get("/proxy/:what/:ids/:end",P_e)},spider:{init:uG,home:cG,homeVod:k_e,category:fG,detail:pG,play:dG,search:hG}};var N4=class extends jn{constructor(){super(),this.siteUrl="http://cj.ffzyapi.com",this.remove18=!1,this.type_id_18=34}async spiderInit(e){e!==null?this.detailProxy=await js2Proxy(e,"detail",this.getHeader()):this.detailProxy=await js2Proxy(!0,this.siteType,this.siteKey,"detail/",this.getHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async parseVodShortListFromJson(e,n=!1){let r=[],l;for(let i of e.list)n?(l=new ln,l.vod_pic=this.detailProxy+R3(i.vod_id),l.vod_id=i.vod_id,l.vod_name=i.vod_name,l.vod_remarks=i.vod_remarks):l=this.parseVodDetail(i),this.remove18&&i.type_id!==this.type_id_18&&r.push(l),!this.remove18&&i.type_id===this.type_id_18&&r.push(l);return r}parseVodDetail(e){let n=new yn;n.vod_id=e.vod_id,n.vod_name=e.vod_name,n.vod_pic=e.vod_pic,n.vod_remarks=e.vod_remarks,n.vod_area=e.vod_area,n.vod_year=e.vod_year,n.vod_actor=e.vod_actor,n.vod_director=e.vod_director;let r=Sr(e.vod_content);return n.vod_content=r.text(),e.vod_down_url!==void 0&&e.vod_down_url.length>0&&(n.vod_play_from="\u76F4\u94FE\u64AD\u653E$$$",n.vod_play_url=e.vod_down_url+"$$$"),n.vod_play_from=n.vod_play_from+e.vod_play_from,n.vod_play_url=n.vod_play_url+e.vod_play_url,n.type_name=e.type_name,n}async parseVodDetailfromJson(e){let n,r=e.list;if(r.length>0){let l=r[0];n=this.parseVodDetail(l)}return n}async setClasses(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of n.class)r.type_pid!==0&&this.classes.push(this.getTypeDic(r.type_name,r.type_id))}async setFilterObj(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of this.classes){let l=r.type_id.toString();if(l!=="\u6700\u8FD1\u66F4\u65B0"){let i={key:"1",name:"\u5206\u7C7B",value:[{n:"\u5168\u90E8",v:l}]};for(let s of n.class){let a=s.type_name;a===this.type_name_18&&(this.type_id_18=s.type_id.toString()),this.remove18?s.type_pid===r.type_id&&a!==this.type_name_18&&i.value.push({n:a,v:s.type_id.toString()}):s.type_pid===r.type_id&&a===this.type_name_18&&i.value.push({n:a,v:s.type_id.toString()})}this.remove18?this.filterObj[l]=[i]:this.classes=[this.getTypeDic("\u6700\u8FD1\u66F4\u65B0","\u6700\u8FD1\u66F4\u65B0"),this.getTypeDic(this.type_name_18,this.type_id_18)]}}}async setHomeVod(){let e=await this.fetch(this.siteUrl+"/index.php/ajax/data",{mid:"1"},this.getHeader());this.homeVodList=await this.parseVodShortListFromJson(JSON.parse(e))}async setDetail(e){let n=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:e},this.getHeader());this.vodDetail=await this.parseVodDetailfromJson(JSON.parse(n))}async setCategory(e,n,r,l){e=l[1]??e;let i=this.siteUrl+`/index.php/ajax/data?mid=1&tid=${e}&page=${n}&limit=20`;await this.jadeLog.debug(`\u5206\u7C7BURL:${i}`);let s=await this.fetch(i,null,this.getHeader());await this.jadeLog.debug(`\u5206\u7C7B\u5185\u5BB9\u4E3A:${s}`),this.vodList=await this.parseVodShortListFromJson(JSON.parse(s))}async setSearch(e,n){let r=await this.fetch(this.siteUrl+"/api.php/provide/vod/",{wd:e},this.getHeader());this.vodList=await this.parseVodShortListFromJson(JSON.parse(r),!0)}async proxy(e,n){await this.jadeLog.debug(`\u6B63\u5728\u8BBE\u7F6E\u53CD\u5411\u4EE3\u7406 segments = ${e.join(",")},headers = ${JSON.stringify(n)}`);let r=e[0],l=R2(e[1]);if(await this.jadeLog.debug(`\u53CD\u5411\u4EE3\u7406\u53C2\u6570\u4E3A:${l}`),r==="detail"){let i=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:l},this.getHeader()),s=await this.parseVodDetailfromJson(JSON.parse(i)),a=await this.fetch(s.vod_pic,null,this.getHeader(),!1,!1,2);return be.isEmpty(a)?JSON.stringify({code:500,buffer:2,content:"",headers:{}}):JSON.stringify({code:200,buffer:2,content:a,headers:{}})}}};var Db=class extends N4{constructor(){super(),this.siteUrl="https://cj.lzcaiji.com",this.remove18=!1}getAppName(){return"\u91CF\u5B50\u8D44\u6E9018+"}getName(){return"\u{1F51E}\u2503\u91CF\u5B50\u8D44\u6E9018+\u2503\u{1F51E}"}getJSName(){return"liangzi18"}getType(){return 3}async spiderInit(e){await super.spiderInit(e)}async init(e){await super.init(e),await this.spiderInit(null)}},an=new Db;var Lb=class extends kn{constructor(){super()}getName(){return an.getName()}getAppName(){return an.getAppName()}getJSName(){return an.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await an.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await an.initCookie(e.server.config.bilicookie),await an.spiderInit(e),an.cfgObj.code=0,an.catOpenStatus=!0,an.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await an.setClasses(),this.classes=an.classes}async setFilterObj(){await an.setFilterObj(),this.filterObj=an.filterObj}async setHomeVod(){await an.setHomeVod(),this.homeVodList=an.homeVodList}async setCategory(e,n,r,l){await an.setCategory(e,n,r,l),this.vodList=an.vodList}async setDetail(e){await an.setDetail(e),this.vodDetail=an.vodDetail}async setPlay(e,n,r){await an.setPlay(e,n,r),this.playUrl=an.playUrl,this.result=an.result}async setSearch(e,n,r){await an.setSearch(e,n,r),this.vodList=an.vodList,this.result=an.result}async setProxy(e,n){return await an.proxy(e,n)}},Cs=new Lb;async function gG(t,e){return await Cs.init(t,e)}async function yG(t,e){return await Cs.home(t,e)}async function D_e(t,e){return await Cs.homeVod(t,e)}async function vG(t,e){return await Cs.category(t,e)}async function _G(t,e){return await Cs.detail(t,e)}async function EG(t,e){return await Cs.play(t,e)}async function bG(t,e){return await Cs.search(t,e)}async function L_e(t,e){return await Cs.proxy(t,e)}var TG={meta:{key:an.getJSName(),name:an.getName(),type:an.getType()},api:async t=>{t.post("/init",gG),t.post("/home",yG),t.post("/category",vG),t.post("/detail",_G),t.post("/play",EG),t.post("/search",bG),t.get("/proxy/:what/:ids/:end",L_e)},spider:{init:gG,home:yG,homeVod:D_e,category:vG,detail:_G,play:EG,search:bG}};var Fb=class extends jn{constructor(){super(),this.siteUrl="https://hongkongdollvideo.com"}getImgHeader(){let e=this.getHeader();return e.Proxy=!0,e}async spiderInit(e=null){e!==null?this.jsBase=await js2Proxy(e,"img",this.getImgHeader()):this.jsBase=await js2Proxy(!0,this.siteType,this.siteKey,"img/",this.getImgHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async getHtml(e=this.siteUrl,n=!1,r=this.getHeader()){return super.getHtml(e,!0,r)}getName(){return"\u{1F51E}\u2503\u73A9\u5076\u59D0\u59D0\u2503\u{1F51E}"}getAppName(){return"\u73A9\u5076\u59D0\u59D0"}getJSName(){return"doll"}getType(){return 3}async parseVodShortListFromDoc(e){let n=[],r=e('[class="row"]').find('[class="video-detail"]');for(let l of r){let i=new ln;i.vod_id=e(l).find("a")[0].attribs.href;let s=e(e(l).find('[class="video-info"]')).find("a");i.vod_name=s[0].attribs.title,i.vod_remarks=e(s[1]).text();let a=e(l).find("img")[0].attribs["data-src"];i.vod_pic=a,n.push(i)}return n}async parseVodDetailFromDoc(e,n){let r=new yn,l=e('[class="container-fluid"]');r.vod_name=e(e(l).find('[class="page-title"]')[0]).text(),r.vod_remarks=e(l).find('[class="tag my-1 text-center"]')[0].attribs.href.replaceAll("/","");let i=e(l).find("video")[0].attribs.poster;r.vod_pic=i;let s=e.html(),a=Qr(/var voteTag="(.*?)";/g,s);a=en.enc.Utf8.stringify(en.enc.Base64.parse(a));let o=[];for(let f=0;f<a.length;f++){let p=f%n.length;o.push(String.fromCharCode(a.charCodeAt(f)^n.charCodeAt(p)))}let c=decodeURIComponent(en.enc.Utf8.stringify(en.enc.Base64.parse(o.join(""))));return r.vod_play_from="\u73A9\u5076\u59D0\u59D0",r.vod_play_url="\u73A9\u5076\u59D0\u59D0$"+c,r}async setClasses(){let e=await this.getHtml(this.siteUrl),n=e('[class="list-unstyled topnav-menu d-flex d-lg-block align-items-center justify-content-center flex-fill topnav-menu-left m-0"]').find("li"),r=1,l=r.toString();this.classes=[],this.classes.push({type_name:"\u9996\u9875",type_id:"1"}),this.filterObj[l]=[];for(let s of n){let a=e(s).text().split(`
`),o=e(s).find("a"),c=[{n:"\u5168\u90E8",v:l}],f=r.toString();for(let p of o){let m=e(p).text().replaceAll(`
`,""),h=p.attribs.href;h!==void 0&&c.push({n:m,v:h})}a=a.filter(p=>p!==""),this.filterObj[l].push({key:f,name:a[0],value:c})}let i=e('[id="side-menu"]').find("li");for(let s of i){let a=e(s).find("a")[0].attribs.href;if(a!==void 0&&a.indexOf(this.siteUrl)>-1){let o={type_name:e(s).text(),type_id:a};this.classes.push(o)}}}async setHomeVod(){let e=await this.getHtml(this.siteUrl);this.homeVodList=await this.parseVodShortListFromDoc(e)}async setCategory(e,n,r,l){l[1]!==void 0&&l[1]!=="1"&&(e=l[1]),await this.jadeLog.info(`tid = ${e}`);let i="";e.indexOf(this.siteUrl)>-1?i=e+n.toString()+".html":i=this.siteUrl,this.limit=36;let s=await this.getHtml(i);this.vodList=await this.parseVodShortListFromDoc(s)}async setDetail(e){let n=await this.getHtml(e),r=Qr(/video\/(\w+).html/,e);this.vodDetail=await this.parseVodDetailFromDoc(n,r)}async setPlay(e,n,r){this.playUrl=n,this.playHeader={}}async setSearch(e,n){let r=this.siteUrl+"search/"+encodeURIComponent(e),l=await this.getHtml(r);this.vodList=await this.parseVodShortListFromDoc(l)}async proxy(e,n){return super.proxy(e,n)}},on=new Fb;var Mb=class extends kn{constructor(){super()}getName(){return on.getName()}getAppName(){return on.getAppName()}getJSName(){return on.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await on.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await on.initCookie(e.server.config.bilicookie),await on.spiderInit(e),on.cfgObj.code=0,on.catOpenStatus=!0,on.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await on.setClasses(),this.classes=on.classes}async setFilterObj(){await on.setFilterObj(),this.filterObj=on.filterObj}async setHomeVod(){await on.setHomeVod(),this.homeVodList=on.homeVodList}async setCategory(e,n,r,l){await on.setCategory(e,n,r,l),this.vodList=on.vodList}async setDetail(e){await on.setDetail(e),this.vodDetail=on.vodDetail}async setPlay(e,n,r){await on.setPlay(e,n,r),this.playUrl=on.playUrl,this.result=on.result}async setSearch(e,n,r){await on.setSearch(e,n,r),this.vodList=on.vodList,this.result=on.result}async setProxy(e,n){return await on.proxy(e,n)}},ks=new Mb;async function SG(t,e){return await ks.init(t,e)}async function xG(t,e){return await ks.home(t,e)}async function F_e(t,e){return await ks.homeVod(t,e)}async function AG(t,e){return await ks.category(t,e)}async function wG(t,e){return await ks.detail(t,e)}async function RG(t,e){return await ks.play(t,e)}async function OG(t,e){return await ks.search(t,e)}async function M_e(t,e){return await ks.proxy(t,e)}var NG={meta:{key:on.getJSName(),name:on.getName(),type:on.getType()},api:async t=>{t.post("/init",SG),t.post("/home",xG),t.post("/category",AG),t.post("/detail",wG),t.post("/play",RG),t.post("/search",OG),t.get("/proxy/:what/:ids/:end",M_e)},spider:{init:SG,home:xG,homeVod:F_e,category:AG,detail:wG,play:RG,search:OG}};var $b=class extends jn{constructor(){super(),this.siteUrl="https://jable.tv",this.cookie=""}async spiderInit(e=null){e!==null?this.jsBase=await js2Proxy(e,"img",this.getImgHeaders()):this.jsBase=await js2Proxy(!0,this.siteType,this.siteKey,"img/",this.getImgHeaders())}getImgHeaders(){return{"User-Agent":"PostmanRuntime/7.37.3","Postman-Token":"c2602692-1a05-4bb0-93cd-270afad97e87",Host:"assets-cdn.jable.tv",Proxy:!0}}async init(e){await super.init(e),await this.spiderInit(null)}getAppName(){return"Jable"}getName(){return"\u{1F51E}\u2503Jable\u2503\u{1F51E}"}getJSName(){return"jable"}getType(){return 3}getHeader(){let e={};return e["User-Agent"]="PostmanRuntime/7.36.3",e.Host="jable.tv",e["Postman-Token"]="33290483-3c8d-413f-a160-0d3aea9e6f95",e}async getHtml(e=this.siteUrl,n=!1,r=this.getHeader()){return super.getHtml(e,!0,r)}async setClasses(){let e=await this.getHtml(this.siteUrl),n=e('[class="title-box"]'),r=e("div.row");for(let l of e(r[0]).find("a")){let i=e(l).text(),s=l.attribs.href;s.indexOf(this.siteUrl)>-1&&this.classes.push(this.getTypeDic(i,s))}n=n.slice(1,9),r=r.slice(1,9);for(let l=0;l<n.length;l++){let i=e(r[l]).find("a")[0].attribs.href;this.classes.push(this.getTypeDic("\u6807\u7B7E",i));break}}async getSortFilter(e){let n=e('[class="sorting-nav"]').find("a"),r={name:"\u6392\u5E8F",key:"sort",value:[]};for(let l of n){let i=l.attribs["data-parameters"].split("sort_by:")[1],s=e(l).text();r.value.push({n:s,v:i})}return r}async getFilter(e,n,r,l){let i=[];if(n<4){let s={name:l,key:"type",value:[]},a=["div.img-box > a",'[class="horizontal-img-box ml-3 mb-3"] > a',"","sort"],o=["div.absolute-center > h4","div.detail"],c=await this.getHtml(r);for(let f of c(a[n])){let p=f.attribs.href,m=e(e(f).find(o[n])).text().replaceAll(" ","").replaceAll(`
`,"").replaceAll(" ","");s.value.push({n:m,v:p})}if(s.value.length>0){i.push(s);let f=await this.getHtml(s.value[0].v),p=await this.getSortFilter(f);p.value.length>0&&i.push(p)}else{let f=await this.getSortFilter(c);f.value.length>0&&i.push(f)}}else{let s=e("div.row").slice(1,9),a=e('[class="title-box"]').slice(1,9);for(let f=0;f<a.length;f++){let p={name:e(e(a[f]).find("h2")).text(),key:"type",value:[]};for(let m of e(s[f]).find("a")){let h=m.attribs.href;h.indexOf(this.siteUrl)>-1&&p.value.push({n:e(m).text(),v:h})}i.push(p)}let o=await this.getHtml(r),c=await this.getSortFilter(o);c.value.length>0&&i.push(c)}return i}async setFilterObj(){let e=await this.getHtml(this.siteUrl),n=this.classes.slice(1);for(let r=0;r<n.length;r++){let l=n[r].type_name,i=n[r].type_id,s=await this.getFilter(e,r,i,l);s.length>1&&r<4&&(i=s[0].value[0].v,this.classes[r+1]=this.getTypeDic(l,i)),this.filterObj[i]=s}}async parseVodShortListFromDoc(e){let n=[],r=e("div.video-img-box");for(let l of r){let i=new ln,s=e(l).find("img").attr("data-src");if(s!==void 0){i.vod_pic=s;let a=e(l).find("a").attr("href");i.vod_id=a.split("/")[4],i.vod_name=a.split("/")[4];let o=e(e(l).find('[class="sub-title"]')).text().split(`
+1 -1
View File
@@ -1 +1 @@
9acc3aa6d144d74f7e7149763dd9a22f
0781ce50eb420e06572003b938aac220
+3 -3
View File
@@ -395,10 +395,10 @@ function print() { __p += __j.call(arguments, '') }
`,LTe=V5.encode(so),FTe=2,Dw=class{constructor(e,n){let{escapeName:r}=this.constructor,i=Z.isString(n),l=`Content-Disposition: form-data; name="${r(e)}"${!i&&n.name?`; filename="${r(n.name)}"`:""}${so}`;i?n=V5.encode(String(n).replace(/\r?\n|\r\n?/g,so)):l+=`Content-Type: ${n.type||"application/octet-stream"}${so}`,this.headers=V5.encode(l+so),this.contentLength=i?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+FTe,this.name=e,this.value=n}async*encode(){yield this.headers;let{value:e}=this;Z.isTypedArray(e)?yield e:yield*hf(e),yield LTe}static escapeName(e){return String(e).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},jTe=(t,e,n)=>{let{tag:r="form-data-boundary",size:i=25,boundary:l=r+"-"+Z.generateString(i,PTe)}=n||{};if(!Z.isFormData(t))throw TypeError("FormData instance required");if(l.length<1||l.length>70)throw Error("boundary must be 10-70 characters long");let s=V5.encode("--"+l+so),a=V5.encode("--"+l+"--"+so+so),o=a.byteLength,u=Array.from(t.entries()).map(([f,m])=>{let d=new Dw(f,m);return o+=d.size,d});o+=s.byteLength*u.length,o=Z.toFiniteNumber(o);let c={"Content-Type":`multipart/form-data; boundary=${l}`};return Number.isFinite(o)&&(c["Content-Length"]=o),e&&e(c),LJ.Readable.from(async function*(){for(let f of u)yield s,yield*f.encode();yield a}())},FJ=jTe;var jJ=Yr(require("stream"),1),Pw=class extends jJ.default.Transform{__transform(e,n,r){this.push(e),r()}_transform(e,n,r){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,n)}this.__transform(e,n,r)}},UJ=Pw;var UTe=(t,e)=>Z.isAsyncFn(t)?function(...n){let r=n.pop();t.apply(this,n).then(i=>{try{e?r(null,...e(i)):r(null,i)}catch(l){r(l)}},r)}:t,MJ=UTe;var $J={flush:l2.default.constants.Z_SYNC_FLUSH,finishFlush:l2.default.constants.Z_SYNC_FLUSH},MTe={flush:l2.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:l2.default.constants.BROTLI_OPERATION_FLUSH},BJ=Z.isFunction(l2.default.createBrotliDecompress),{http:$Te,https:BTe}=KJ.default,HTe=/https:?/,HJ=ii.protocols.map(t=>t+":");function VTe(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function WJ(t,e,n){let r=e;if(!r&&r!==!1){let i=(0,qJ.getProxyForUrl)(n);i&&(r=new URL(i))}if(r){if(r.username&&(r.auth=(r.username||"")+":"+(r.password||"")),r.auth){(r.auth.username||r.auth.password)&&(r.auth=(r.auth.username||"")+":"+(r.auth.password||""));let l=Buffer.from(r.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+l}t.headers.host=t.hostname+(t.port?":"+t.port:"");let i=r.hostname||r.host;t.hostname=i,t.host=i,t.port=r.port,t.path=n,r.protocol&&(t.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`)}t.beforeRedirects.proxy=function(l){WJ(l,e,l.href)}}var qTe=typeof process<"u"&&Z.kindOf(process)==="process",zTe=t=>new Promise((e,n)=>{let r,i,l=(o,u)=>{i||(i=!0,r&&r(o,u))},s=o=>{l(o),e(o)},a=o=>{l(o,!0),n(o)};t(s,a,o=>r=o).catch(a)}),GTe=({address:t,family:e})=>{if(!Z.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},VJ=(t,e)=>GTe(Z.isObject(t)?t:{address:t,family:e}),YJ=qTe&&function(e){return zTe(async function(r,i,l){let{data:s,lookup:a,family:o}=e,{responseType:u,responseEncoding:c}=e,f=e.method.toUpperCase(),m,d=!1,y;if(a){let ee=MJ(a,me=>Z.isArray(me)?me:[me]);a=(me,P,G)=>{ee(me,P,(V,q,Zn)=>{if(V)return G(V);let Tt=Z.isArray(q)?q.map(Qe=>VJ(Qe)):[VJ(q,Zn)];P.all?G(V,Tt):G(V,Tt[0].address,Tt[0].family)})}}let _=new XJ.default,S=()=>{e.cancelToken&&e.cancelToken.unsubscribe(w),e.signal&&e.signal.removeEventListener("abort",w),_.removeAllListeners()};l((ee,me)=>{m=!0,me&&(d=!0,S())});function w(ee){_.emit("abort",!ee||ee.type?new ks(null,e,y):ee)}_.once("abort",i),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(w),e.signal&&(e.signal.aborted?w():e.signal.addEventListener("abort",w)));let E=mu(e.baseURL,e.url),g=new URL(E,"http://localhost"),v=g.protocol||HJ[0];if(v==="data:"){let ee;if(f!=="GET")return lo(r,i,{status:405,statusText:"method not allowed",headers:{},config:e});try{ee=Rw(e.url,u==="blob",{Blob:e.env&&e.env.Blob})}catch(me){throw qe.from(me,qe.ERR_BAD_REQUEST,e)}return u==="text"?(ee=ee.toString(c),(!c||c==="utf8")&&(ee=Z.stripBOM(ee))):u==="stream"&&(ee=vu.default.Readable.from(ee)),lo(r,i,{data:ee,status:200,statusText:"OK",headers:new li,config:e})}if(HJ.indexOf(v)===-1)return i(new qe("Unsupported protocol "+v,qe.ERR_BAD_REQUEST,e));let x=li.from(e.headers).normalize();x.set("User-Agent","axios/"+gu,!1);let O=e.onDownloadProgress,N=e.onUploadProgress,R=e.maxRate,U,F;if(Z.isSpecCompliantForm(s)){let ee=x.getContentType(/boundary=([-_\w\d]{10,70})/i);s=FJ(s,me=>{x.set(me)},{tag:`axios-${gu}-boundary`,boundary:ee&&ee[1]||void 0})}else if(Z.isFormData(s)&&Z.isFunction(s.getHeaders)){if(x.set(s.getHeaders()),!x.hasContentLength())try{let ee=await JJ.default.promisify(s.getLength).call(s);Number.isFinite(ee)&&ee>=0&&x.setContentLength(ee)}catch{}}else if(Z.isBlob(s))s.size&&x.setContentType(s.type||"application/octet-stream"),x.setContentLength(s.size||0),s=vu.default.Readable.from(hf(s));else if(s&&!Z.isStream(s)){if(!Buffer.isBuffer(s))if(Z.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else if(Z.isString(s))s=Buffer.from(s,"utf-8");else return i(new qe("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",qe.ERR_BAD_REQUEST,e));if(x.setContentLength(s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return i(new qe("Request body larger than maxBodyLength limit",qe.ERR_BAD_REQUEST,e))}let te=Z.toFiniteNumber(x.getContentLength());Z.isArray(R)?(U=R[0],F=R[1]):U=F=R,s&&(N||U)&&(Z.isStream(s)||(s=vu.default.Readable.from(s,{objectMode:!1})),s=vu.default.pipeline([s,new kw({length:te,maxRate:Z.toFiniteNumber(U)})],Z.noop),N&&s.on("progress",ee=>{N(Object.assign(ee,{upload:!0}))}));let Q;if(e.auth){let ee=e.auth.username||"",me=e.auth.password||"";Q=ee+":"+me}if(!Q&&g.username){let ee=g.username,me=g.password;Q=ee+":"+me}Q&&x.delete("authorization");let W;try{W=hu(g.pathname+g.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ee){let me=new Error(ee.message);return me.config=e,me.url=e.url,me.exists=!0,i(me)}x.set("Accept-Encoding","gzip, compress, deflate"+(BJ?", br":""),!1);let ce={path:W,method:f,headers:x.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:Q,protocol:v,family:o,beforeRedirect:VTe,beforeRedirects:{}};!Z.isUndefined(a)&&(ce.lookup=a),e.socketPath?ce.socketPath=e.socketPath:(ce.hostname=g.hostname,ce.port=g.port,WJ(ce,e.proxy,v+"//"+g.hostname+(g.port?":"+g.port:"")+ce.path));let we,se=HTe.test(ce.protocol);if(ce.agent=se?e.httpsAgent:e.httpAgent,e.transport?we=e.transport:e.maxRedirects===0?we=se?GJ.default:zJ.default:(e.maxRedirects&&(ce.maxRedirects=e.maxRedirects),e.beforeRedirect&&(ce.beforeRedirects.config=e.beforeRedirect),we=se?BTe:$Te),e.maxBodyLength>-1?ce.maxBodyLength=e.maxBodyLength:ce.maxBodyLength=1/0,e.insecureHTTPParser&&(ce.insecureHTTPParser=e.insecureHTTPParser),y=we.request(ce,function(me){if(y.destroyed)return;let P=[me],G=+me.headers["content-length"];if(O){let Qe=new kw({length:Z.toFiniteNumber(G),maxRate:Z.toFiniteNumber(F)});O&&Qe.on("progress",pt=>{O(Object.assign(pt,{download:!0}))}),P.push(Qe)}let V=me,q=me.req||y;if(e.decompress!==!1&&me.headers["content-encoding"])switch((f==="HEAD"||me.statusCode===204)&&delete me.headers["content-encoding"],(me.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":P.push(l2.default.createUnzip($J)),delete me.headers["content-encoding"];break;case"deflate":P.push(new UJ),P.push(l2.default.createUnzip($J)),delete me.headers["content-encoding"];break;case"br":BJ&&(P.push(l2.default.createBrotliDecompress(MTe)),delete me.headers["content-encoding"])}V=P.length>1?vu.default.pipeline(P,Z.noop):P[0];let Zn=vu.default.finished(V,()=>{Zn(),S()}),Tt={status:me.statusCode,statusText:me.statusMessage,headers:new li(me.headers),config:e,request:q};if(u==="stream")Tt.data=V,lo(r,i,Tt);else{let Qe=[],pt=0;V.on("data",function(Ue){Qe.push(Ue),pt+=Ue.length,e.maxContentLength>-1&&pt>e.maxContentLength&&(d=!0,V.destroy(),i(new qe("maxContentLength size of "+e.maxContentLength+" exceeded",qe.ERR_BAD_RESPONSE,e,q)))}),V.on("aborted",function(){if(d)return;let Ue=new qe("maxContentLength size of "+e.maxContentLength+" exceeded",qe.ERR_BAD_RESPONSE,e,q);V.destroy(Ue),i(Ue)}),V.on("error",function(Ue){y.destroyed||i(qe.from(Ue,null,e,q))}),V.on("end",function(){try{let Ue=Qe.length===1?Qe[0]:Buffer.concat(Qe);u!=="arraybuffer"&&(Ue=Ue.toString(c),(!c||c==="utf8")&&(Ue=Z.stripBOM(Ue))),Tt.data=Ue}catch(Ue){return i(qe.from(Ue,null,e,Tt.request,Tt))}lo(r,i,Tt)})}_.once("abort",Qe=>{V.destroyed||(V.emit("error",Qe),V.destroy())})}),_.once("abort",ee=>{i(ee),y.destroy(ee)}),y.on("error",function(me){i(qe.from(me,null,e,y))}),y.on("socket",function(me){me.setKeepAlive(!0,1e3*60)}),e.timeout){let ee=parseInt(e.timeout,10);if(Number.isNaN(ee)){i(new qe("error trying to parse `config.timeout` to int",qe.ERR_BAD_OPTION_VALUE,e,y));return}y.setTimeout(ee,function(){if(m)return;let P=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",G=e.transitional||R0;e.timeoutErrorMessage&&(P=e.timeoutErrorMessage),i(new qe(P,G.clarifyTimeoutError?qe.ETIMEDOUT:qe.ECONNABORTED,e,y)),w()})}if(Z.isStream(s)){let ee=!1,me=!1;s.on("end",()=>{ee=!0}),s.once("error",P=>{me=!0,y.destroy(P)}),s.on("close",()=>{!ee&&!me&&w(new ks("Request stream has been aborted",e,y))}),s.pipe(y)}else y.end(s)})};var QJ=ii.hasStandardBrowserEnv?{write(t,e,n,r,i,l){let s=[t+"="+encodeURIComponent(e)];Z.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),Z.isString(r)&&s.push("path="+r),Z.isString(i)&&s.push("domain="+i),l===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var ZJ=ii.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),r;function i(l){let s=l;return e&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=i(window.location.href),function(s){let a=Z.isString(s)?i(s):s;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function eK(t,e){let n=0,r=ff(50,250);return i=>{let l=i.loaded,s=i.lengthComputable?i.total:void 0,a=l-n,o=r(a),u=l<=s;n=l;let c={loaded:l,total:s,progress:s?l/s:void 0,bytes:a,rate:o||void 0,estimated:o&&s&&u?(s-l)/o:void 0,event:i};c[e?"download":"upload"]=!0,t(c)}}var JTe=typeof XMLHttpRequest<"u",tK=JTe&&function(t){return new Promise(function(n,r){let i=t.data,l=li.from(t.headers).normalize(),{responseType:s,withXSRFToken:a}=t,o;function u(){t.cancelToken&&t.cancelToken.unsubscribe(o),t.signal&&t.signal.removeEventListener("abort",o)}let c;if(Z.isFormData(i)){if(ii.hasStandardBrowserEnv||ii.hasStandardBrowserWebWorkerEnv)l.setContentType(!1);else if((c=l.getContentType())!==!1){let[_,...S]=c?c.split(";").map(w=>w.trim()).filter(Boolean):[];l.setContentType([_||"multipart/form-data",...S].join("; "))}}let f=new XMLHttpRequest;if(t.auth){let _=t.auth.username||"",S=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";l.set("Authorization","Basic "+btoa(_+":"+S))}let m=mu(t.baseURL,t.url);f.open(t.method.toUpperCase(),hu(m,t.params,t.paramsSerializer),!0),f.timeout=t.timeout;function d(){if(!f)return;let _=li.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),w={data:!s||s==="text"||s==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:_,config:t,request:f};lo(function(g){n(g),u()},function(g){r(g),u()},w),f=null}if("onloadend"in f?f.onloadend=d:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(d)},f.onabort=function(){f&&(r(new qe("Request aborted",qe.ECONNABORTED,t,f)),f=null)},f.onerror=function(){r(new qe("Network Error",qe.ERR_NETWORK,t,f)),f=null},f.ontimeout=function(){let S=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",w=t.transitional||R0;t.timeoutErrorMessage&&(S=t.timeoutErrorMessage),r(new qe(S,w.clarifyTimeoutError?qe.ETIMEDOUT:qe.ECONNABORTED,t,f)),f=null},ii.hasStandardBrowserEnv&&(a&&Z.isFunction(a)&&(a=a(t)),a||a!==!1&&ZJ(m))){let _=t.xsrfHeaderName&&t.xsrfCookieName&&QJ.read(t.xsrfCookieName);_&&l.set(t.xsrfHeaderName,_)}i===void 0&&l.setContentType(null),"setRequestHeader"in f&&Z.forEach(l.toJSON(),function(S,w){f.setRequestHeader(w,S)}),Z.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),s&&s!=="json"&&(f.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&f.addEventListener("progress",eK(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",eK(t.onUploadProgress)),(t.cancelToken||t.signal)&&(o=_=>{f&&(r(!_||_.type?new ks(null,t,f):_),f.abort(),f=null)},t.cancelToken&&t.cancelToken.subscribe(o),t.signal&&(t.signal.aborted?o():t.signal.addEventListener("abort",o)));let y=H5(m);if(y&&ii.protocols.indexOf(y)===-1){r(new qe("Unsupported protocol "+y+":",qe.ERR_BAD_REQUEST,t));return}f.send(i||null)})};var Lw={http:YJ,xhr:tK};Z.forEach(Lw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var nK=t=>`- ${t}`,KTe=t=>Z.isFunction(t)||t===null||t===!1,mf={getAdapter:t=>{t=Z.isArray(t)?t:[t];let{length:e}=t,n,r,i={};for(let l=0;l<e;l++){n=t[l];let s;if(r=n,!KTe(n)&&(r=Lw[(s=String(n)).toLowerCase()],r===void 0))throw new qe(`Unknown adapter '${s}'`);if(r)break;i[s||"#"+l]=r}if(!r){let l=Object.entries(i).map(([a,o])=>`adapter ${a} `+(o===!1?"is not supported by the environment":"is not available in the build")),s=e?l.length>1?`since :
`+l.map(nK).join(`
`):" "+nK(l[0]):"as no adapter specified";throw new qe("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Lw};function Fw(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ks(null,t)}function yf(t){return Fw(t),t.headers=li.from(t.headers),t.data=L5.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),mf.getAdapter(t.adapter||I0.adapter)(t).then(function(r){return Fw(t),r.data=L5.call(t,t.transformResponse,r),r.headers=li.from(r.headers),r},function(r){return F5(r)||(Fw(t),r&&r.response&&(r.response.data=L5.call(t,t.transformResponse,r.response),r.response.headers=li.from(r.response.headers))),Promise.reject(r)})}var rK=t=>t instanceof li?t.toJSON():t;function s2(t,e){e=e||{};let n={};function r(u,c,f){return Z.isPlainObject(u)&&Z.isPlainObject(c)?Z.merge.call({caseless:f},u,c):Z.isPlainObject(c)?Z.merge({},c):Z.isArray(c)?c.slice():c}function i(u,c,f){if(Z.isUndefined(c)){if(!Z.isUndefined(u))return r(void 0,u,f)}else return r(u,c,f)}function l(u,c){if(!Z.isUndefined(c))return r(void 0,c)}function s(u,c){if(Z.isUndefined(c)){if(!Z.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function a(u,c,f){if(f in e)return r(u,c);if(f in t)return r(void 0,u)}let o={url:l,method:l,data:l,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(u,c)=>i(rK(u),rK(c),!0)};return Z.forEach(Object.keys(Object.assign({},t,e)),function(c){let f=o[c]||i,m=f(t[c],e[c],c);Z.isUndefined(m)&&f!==a||(n[c]=m)}),n}var jw={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{jw[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});var iK={};jw.transitional=function(e,n,r){function i(l,s){return"[Axios v"+gu+"] Transitional option '"+l+"'"+s+(r?". "+r:"")}return(l,s,a)=>{if(e===!1)throw new qe(i(s," has been removed"+(n?" in "+n:"")),qe.ERR_DEPRECATED);return n&&!iK[s]&&(iK[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(l,s,a):!0}};function XTe(t,e,n){if(typeof t!="object")throw new qe("options must be an object",qe.ERR_BAD_OPTION_VALUE);let r=Object.keys(t),i=r.length;for(;i-- >0;){let l=r[i],s=e[l];if(s){let a=t[l],o=a===void 0||s(a,l,t);if(o!==!0)throw new qe("option "+l+" must be "+o,qe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new qe("Unknown option "+l,qe.ERR_BAD_OPTION)}}var gf={assertOptions:XTe,validators:jw};var ao=gf.validators,P0=class{constructor(e){this.defaults=e,this.interceptors={request:new pw,response:new pw}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let l=i.stack?i.stack.replace(/^.+\n/,""):"";r.stack?l&&!String(r.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+l):r.stack=l}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=s2(this.defaults,n);let{transitional:r,paramsSerializer:i,headers:l}=n;r!==void 0&&gf.assertOptions(r,{silentJSONParsing:ao.transitional(ao.boolean),forcedJSONParsing:ao.transitional(ao.boolean),clarifyTimeoutError:ao.transitional(ao.boolean)},!1),i!=null&&(Z.isFunction(i)?n.paramsSerializer={serialize:i}:gf.assertOptions(i,{encode:ao.function,serialize:ao.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=l&&Z.merge(l.common,l[n.method]);l&&Z.forEach(["delete","get","head","post","put","patch","common"],y=>{delete l[y]}),n.headers=li.concat(s,l);let a=[],o=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(n)===!1||(o=o&&_.synchronous,a.unshift(_.fulfilled,_.rejected))});let u=[];this.interceptors.response.forEach(function(_){u.push(_.fulfilled,_.rejected)});let c,f=0,m;if(!o){let y=[yf.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,u),m=y.length,c=Promise.resolve(n);f<m;)c=c.then(y[f++],y[f++]);return c}m=a.length;let d=n;for(f=0;f<m;){let y=a[f++],_=a[f++];try{d=y(d)}catch(S){_.call(this,S);break}}try{c=yf.call(this,d)}catch(y){return Promise.reject(y)}for(f=0,m=u.length;f<m;)c=c.then(u[f++],u[f++]);return c}getUri(e){e=s2(this.defaults,e);let n=mu(e.baseURL,e.url);return hu(n,e.params,e.paramsSerializer)}};Z.forEach(["delete","get","head","options"],function(e){P0.prototype[e]=function(n,r){return this.request(s2(r||{},{method:e,url:n,data:(r||{}).data}))}});Z.forEach(["post","put","patch"],function(e){function n(r){return function(l,s,a){return this.request(s2(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:s}))}}P0.prototype[e]=n(),P0.prototype[e+"Form"]=n(!0)});var q5=P0;var Uw=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});let r=this;this.promise.then(i=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](i);r._listeners=null}),this.promise.then=i=>{let l,s=new Promise(a=>{r.subscribe(a),l=a}).then(i);return s.cancel=function(){r.unsubscribe(l)},s},e(function(l,s,a){r.reason||(r.reason=new ks(l,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},lK=Uw;function Mw(t){return function(n){return t.apply(null,n)}}function $w(t){return Z.isObject(t)&&t.isAxiosError===!0}var Bw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Bw).forEach(([t,e])=>{Bw[e]=t});var sK=Bw;function aK(t){let e=new q5(t),n=I5(q5.prototype.request,e);return Z.extend(n,q5.prototype,e,{allOwnKeys:!0}),Z.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return aK(s2(t,i))},n}var Gr=aK(I0);Gr.Axios=q5;Gr.CanceledError=ks;Gr.CancelToken=lK;Gr.isCancel=F5;Gr.VERSION=gu;Gr.toFormData=io;Gr.AxiosError=qe;Gr.Cancel=Gr.CanceledError;Gr.all=function(e){return Promise.all(e)};Gr.spread=Mw;Gr.isAxiosError=$w;Gr.mergeConfig=s2;Gr.AxiosHeaders=li;Gr.formToJSON=t=>cf(Z.isHTMLForm(t)?new FormData(t):t);Gr.getAdapter=mf.getAdapter;Gr.HttpStatusCode=sK;Gr.default=Gr;var L0=Gr;var{Axios:bUe,AxiosError:wUe,CanceledError:SUe,isCancel:TUe,CancelToken:xUe,VERSION:AUe,all:OUe,Cancel:NUe,isAxiosError:CUe,spread:RUe,toFormData:oK,AxiosHeaders:IUe,HttpStatusCode:kUe,formToJSON:DUe,getAdapter:PUe,mergeConfig:LUe}=L0;var yK=Yr(require("https"),1),gK=Yr(require("crypto"),1),vK=Yr(hK(),1),qw={};globalThis.dataBase=null;globalThis.local={get:async function(t,e){return await rxe(t,e)},set:async function(t,e,n){await ixe(t,e,n)}};async function rxe(t,e){let n="/js_"+t+`/${e}/`;return await dataBase.getObjectDefault(n,{})}async function ixe(t,e,n){let r="/js_"+t;qw=await dataBase.getObjectDefault(r,{}),qw[e]=n,t==="log"&&await req("http://192.168.0.116:8099/upload",{data:{log:n+`
`+l):r.stack=l}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=s2(this.defaults,n);let{transitional:r,paramsSerializer:i,headers:l}=n;r!==void 0&&gf.assertOptions(r,{silentJSONParsing:ao.transitional(ao.boolean),forcedJSONParsing:ao.transitional(ao.boolean),clarifyTimeoutError:ao.transitional(ao.boolean)},!1),i!=null&&(Z.isFunction(i)?n.paramsSerializer={serialize:i}:gf.assertOptions(i,{encode:ao.function,serialize:ao.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=l&&Z.merge(l.common,l[n.method]);l&&Z.forEach(["delete","get","head","post","put","patch","common"],y=>{delete l[y]}),n.headers=li.concat(s,l);let a=[],o=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(n)===!1||(o=o&&_.synchronous,a.unshift(_.fulfilled,_.rejected))});let u=[];this.interceptors.response.forEach(function(_){u.push(_.fulfilled,_.rejected)});let c,f=0,m;if(!o){let y=[yf.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,u),m=y.length,c=Promise.resolve(n);f<m;)c=c.then(y[f++],y[f++]);return c}m=a.length;let d=n;for(f=0;f<m;){let y=a[f++],_=a[f++];try{d=y(d)}catch(S){_.call(this,S);break}}try{c=yf.call(this,d)}catch(y){return Promise.reject(y)}for(f=0,m=u.length;f<m;)c=c.then(u[f++],u[f++]);return c}getUri(e){e=s2(this.defaults,e);let n=mu(e.baseURL,e.url);return hu(n,e.params,e.paramsSerializer)}};Z.forEach(["delete","get","head","options"],function(e){P0.prototype[e]=function(n,r){return this.request(s2(r||{},{method:e,url:n,data:(r||{}).data}))}});Z.forEach(["post","put","patch"],function(e){function n(r){return function(l,s,a){return this.request(s2(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:s}))}}P0.prototype[e]=n(),P0.prototype[e+"Form"]=n(!0)});var q5=P0;var Uw=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});let r=this;this.promise.then(i=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](i);r._listeners=null}),this.promise.then=i=>{let l,s=new Promise(a=>{r.subscribe(a),l=a}).then(i);return s.cancel=function(){r.unsubscribe(l)},s},e(function(l,s,a){r.reason||(r.reason=new ks(l,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},lK=Uw;function Mw(t){return function(n){return t.apply(null,n)}}function $w(t){return Z.isObject(t)&&t.isAxiosError===!0}var Bw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Bw).forEach(([t,e])=>{Bw[e]=t});var sK=Bw;function aK(t){let e=new q5(t),n=I5(q5.prototype.request,e);return Z.extend(n,q5.prototype,e,{allOwnKeys:!0}),Z.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return aK(s2(t,i))},n}var Gr=aK(I0);Gr.Axios=q5;Gr.CanceledError=ks;Gr.CancelToken=lK;Gr.isCancel=F5;Gr.VERSION=gu;Gr.toFormData=io;Gr.AxiosError=qe;Gr.Cancel=Gr.CanceledError;Gr.all=function(e){return Promise.all(e)};Gr.spread=Mw;Gr.isAxiosError=$w;Gr.mergeConfig=s2;Gr.AxiosHeaders=li;Gr.formToJSON=t=>cf(Z.isHTMLForm(t)?new FormData(t):t);Gr.getAdapter=mf.getAdapter;Gr.HttpStatusCode=sK;Gr.default=Gr;var L0=Gr;var{Axios:bUe,AxiosError:wUe,CanceledError:SUe,isCancel:TUe,CancelToken:xUe,VERSION:AUe,all:OUe,Cancel:NUe,isAxiosError:CUe,spread:RUe,toFormData:oK,AxiosHeaders:IUe,HttpStatusCode:kUe,formToJSON:DUe,getAdapter:PUe,mergeConfig:LUe}=L0;var yK=Yr(require("https"),1),gK=Yr(require("crypto"),1),vK=Yr(hK(),1),qw={};globalThis.dataBase=null;globalThis.local={get:async function(t,e){return await rxe(t,e)},set:async function(t,e,n){await ixe(t,e,n)}};async function rxe(t,e){let n="/js_"+t+`/${e}/`;return await dataBase.getObjectDefault(n,{})}async function ixe(t,e,n){let r="/js_"+t;qw=await dataBase.getObjectDefault(r,{}),qw[e]=n,t==="log"&&await req("http://127.0.0.1:8099/upload",{data:{log:n+`
`},timeout:.1}),await dataBase.push(r,qw)}globalThis.localLog={set:async function(t,e,n){sxe(t,e,n)}};function lxe(){_u.default.existsSync("log")||_u.default.mkdirSync("log");let t="log/info.log";return _u.default.existsSync(t)?_u.default.readFileSync(t).toString():(_u.default.writeFileSync(t,""),"")}function sxe(t){_u.default.writeFileSync("log/info.log",lxe()+`
`+t)}globalThis.req=axe;async function axe(t,e){try{let n=e&&e.data||null,r=e&&e.postType||null,i=e&&e.buffer||0,l=e&&e.timeout||5e3,s=(e&&e.redirect||1)===1,a=e.proxy??!1,o=e?e.headers||{}:{};r==="form"?(o["Content-Type"]="application/x-www-form-urlencoded",n!=null&&(n=mK.default.stringify(n,{encode:!1}))):r==="form-data"&&(o["Content-Type"]="multipart/form-data",n=oK(n));let u=i===1||i===2?"arraybuffer":void 0,c;a?c=vK.default.httpsOverHttp({proxy:{host:"127.0.0.1",port:7890}}):c=yK.default.Agent({rejectUnauthorized:!1});let f=await L0(t,{responseType:u,method:e&&e.method||"get",headers:o,data:n,timeout:l,maxRedirects:s?null:0,httpsAgent:c});n=f.data;let m={};for(let d of f.headers){let y=d[1];m[d[0]]=Array.isArray(y)&&y.length===1?y[0]:y}if(!i)typeof n=="object"&&(n=JSON.stringify(n));else{if(i===1)return{code:f.status,headers:m,content:n};if(i===2)return{code:f.status,headers:m,content:n.toString("base64")};if(i===3){let d=e.stream;return d.onResp&&await d.onResp({code:f.status,headers:m}),d.onData?(n.on("data",async y=>{await d.onData(y)}),n.on("end",async()=>{d.onDone&&await d.onDone()})):d.onDone&&await d.onDone(),"stream..."}}return{code:f.status,headers:m,content:n}}catch(n){let r=n.response;try{return{code:r.status,headers:r.headers,content:JSON.stringify(r.data)}}catch{return{headers:{},content:""}}}}globalThis.md5X=oxe;function oxe(t){return gK.default.createHash("md5").update(Buffer.from(t,"utf8")).digest("hex")}globalThis.js2Proxy=function(t,e,n){let r=Object.keys(n).length===0?" ":encodeURIComponent(JSON.stringify(n));return t.server.address().dynamic+t.server.prefix+"/proxy/"+encodeURIComponent(e)+"/"+r+"/"};var uxe=["DEBUG","INFO","WARNING","ERROR"];var j0=class{constructor(e,n="DEBUG"){this.app_name=e,this.level=n,this.level_index=uxe.indexOf(n)}format(e,n){let r=80;switch(e){case"INFO":r=r+1;break;case"WARNING":r=r-2;break;default:break}return n.length<r&&((r-n.length)%2===0?n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)):n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)+1)),n}getTime(){let e=new Date;return e.toLocaleDateString().replace(/\//g,"-")+" "+e.toTimeString().substr(0,8)+","+e.getMilliseconds().toString()}formatMessage(e,n,r){return r&&(n=this.format(e,n)),`${this.getTime()} - ${this.app_name} - ${e}: ${n}`}async log(e){console.debug(e),await req("http://192.168.0.116:8099/upload",{data:{log:e+`
`},timeout:.1})}async info(e,n){this.level_index<=1&&await this.log(this.formatMessage("INFO",e,n))}async warning(e,n){this.level_index<=2&&await this.log(this.formatMessage("WARNING",e,n))}async error(e,n){this.level_index<=3&&await this.log(this.formatMessage("ERROR",e,n))}async debug(e,n){this.level_index<=0&&await this.log(this.formatMessage("DEBUG",e,n))}};var Re=class extends Fe{constructor(){super(),this.jadeLog=new j0(this.getAppName(),"DEBUG")}async init(e,n){await this.jadeLog.info("\u521D\u59CB\u5316",!0);try{await await req("http://192.168.0.116:8099/clear",{timeout:.1}),this.siteKey=this.getJSName(),this.siteType=this.getType(),this.cfgObj=e.server.config[this.siteKey],this.deviceKey=e.server.prefix+"/",this.db=e.server.db,this.catOpenStatus=!0,this.danmuStaus=!1;try{await this.loadFilterAndClasses()?await this.jadeLog.debug("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u6210\u529F"):(await this.jadeLog.warning("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u5931\u8D25"),await this.writeFilterAndClasses())}catch(r){await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),await this.jadeLog.error("\u8BFB\u53D6\u7F13\u5B58\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+r,!1)}}catch(r){await this.jadeLog.error(`\u521D\u59CB\u5316\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}await this.jadeLog.info("\u521D\u59CB\u5316\u5B8C\u6210",!0)}async loadFilterAndClasses(){return this.classes=await this.getClassesCache(),this.filterObj=await this.getFiletObjCache(),this.classes.length>0?!0:(await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),!1)}async writeFilterAndClasses(){this.catOpenStatus&&this.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await this.setClasses(),await this.setFilterObj(),await this.db.push(this.deviceKey+"classes",this.classes),await this.db.push(this.deviceKey+"filterObj",this.filterObj)}async getClassesCache(){let e=await this.db.getObjectDefault(this.deviceKey+"classes",{});return B.isEmpty(e)?this.classes:e}async getFiletObjCache(){let e=await this.db.getObjectDefault(this.deviceKey+"filterObj",{});return B.isEmpty(e)?this.filterObj:e}async home(e,n){return this.vodList=[],await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u7C7B\u522B",!0),await this.setHome(),await this.jadeLog.debug(`\u9996\u9875\u7C7B\u522B\u5185\u5BB9\u4E3A:${this.result.home(this.classes,[],this.filterObj)}`),await this.jadeLog.info("\u9996\u9875\u7C7B\u522B\u89E3\u6790\u5B8C\u6210",!0),this.result.home(this.classes,[],this.filterObj)}async homeVod(){await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u5185\u5BB9",!0);try{return await this.setHomeVod(),await this.jadeLog.debug(`\u9996\u9875\u5185\u5BB9\u4E3A:${this.result.homeVod(this.homeVodList)}`),await this.jadeLog.info("\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5B8C\u6210",!0),this.result.homeVod(this.homeVodList)}catch(e){await this.jadeLog.error(`\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${e}`)}}async category(e,n){let r=e.body.id,i=e.body.page,l=!0,s=e.body.filters;if(this.page=parseInt(i),await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u5206\u7C7B\u9875\u9762,tid = ${r},pg = ${i},extend = ${JSON.stringify(s)}`),r==="\u6700\u8FD1\u66F4\u65B0")return this.page=0,await this.homeVod();try{return this.vodList=[],await this.setCategory(r,i,l,s),await this.jadeLog.debug(`\u5206\u7C7B\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}`),await this.jadeLog.info("\u5206\u7C7B\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}catch(a){await this.jadeLog.error(`\u5206\u7C7B\u9875\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${a}`)}}async detail(e,n){await this.jadeLog.debug(`\u83B7\u53D6\u8BE6\u60C5\u9875\u9762:${JSON.stringify(e.body)}`);let i=(Array.isArray(e.body.id)?e.body.id:[e.body.id])[0];this.vodDetail=new Be,await this.jadeLog.info(`\u6B63\u5728\u83B7\u53D6\u8BE6\u60C5\u9875\u9762,id\u4E3A:${i}`);try{return await this.setDetail(i),await this.jadeLog.debug(`\u8BE6\u60C5\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.detail(this.vodDetail)}`),await this.jadeLog.info("\u8BE6\u60C5\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.vodDetail.vod_id=i,this.result.detail(this.vodDetail)}catch(l){await this.jadeLog.error("\u8BE6\u60C5\u754C\u9762\u83B7\u53D6\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+l)}}async play(e,n){let r=e.body.flag,i=e.body.id,l=[];await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u64AD\u653E\u9875\u9762,flag:${r},id:${i},flags:${l}`,!0);try{let s;if(await this.setPlay(r,i,l),this.playUrl.content!==void 0)return this.playUrl;if(await this.jadeLog.debug("\u4E0D\u9700\u8981\u52A0\u8F7D\u5F39\u5E55",!0),this.result.jx===1&&this.playUrl.indexOf(".m3u8")<0){let a=await e.server.messageToDart({action:"sniff",opt:{url:i,timeout:6e4,rule:"http((?!http).){12,}?\\.m3u8?"}});if(a&&a.url){let o={};a.headers&&(a.headers["user-agent"]&&(o["User-Agent"]=a.headers["user-agent"]),a.headers.referer&&(o.Referer=a.headers.referer)),await this.jadeLog.debug(`\u55C5\u63A2\u6210\u529F,\u64AD\u653E\u8FDE\u63A5\u4E3A:${a.url}`),s=JSON.stringify({parse:0,url:a.url,header:a.headers,jx:"0"})}else await this.jadeLog.error("\u89E3\u6790\u5931\u8D25,\u65E0\u6CD5\u55C5\u63A2\u5230\u64AD\u653E\u8FDE\u63A5"),s=JSON.stringify({parse:0,url:"",jx:"0"})}else s=this.result.play(this.playUrl);return await this.jadeLog.info("\u64AD\u653E\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),await this.jadeLog.debug(`\u64AD\u653E\u9875\u9762\u5185\u5BB9\u4E3A:${s}`),s}catch(s){await this.jadeLog.error("\u89E3\u6790\u64AD\u653E\u9875\u9762\u51FA\u9519,\u5931\u8D25\u539F\u56E0\u4E3A:"+s)}}async search(e,n){let r=e.body.page,i=e.body.wd,l=!0;return this.vodList=[],await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u641C\u7D22\u9875\u9762,\u5173\u952E\u8BCD\u4E3A = ${i},quick = ${l},pg = ${r}`),await this.setSearch(i,l,r),this.vodList.length===0&&i.indexOf(" ")>-1&&(await this.jadeLog.debug(`\u641C\u7D22\u5173\u952E\u8BCD\u4E3A:${i},\u5176\u4E2D\u6709\u7A7A\u683C,\u53BB\u9664\u7A7A\u683C\u5728\u641C\u7D22\u4E00\u6B21`),await this.search(i.replaceAll(" ","").replaceAll("?",""),l)),await this.jadeLog.debug(`\u641C\u7D22\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.search(this.vodList)}`),await this.jadeLog.info("\u641C\u7D22\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.search(this.vodList)}async proxy(e,n){try{let r=e.params.what,i={};try{i=JSON.parse(e.params.ids)}catch{}let l=decodeURIComponent(e.params.end),s=JSON.parse(await this.setProxy([r,l],i));return r==="dash"?(await this.jadeLog.debug(`dash:${JSON.stringify(s)}`),n.code(s.code).headers(s.headers),s.content):s.code===200?(n.code(s.code).headers(s.headers),Buffer.from(s.content,"base64")):(n.code(500),"")}catch(r){await this.jadeLog.error(`\u4EE3\u7406\u56DE\u8C03\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}}};var uo=class extends Fe{constructor(){super(),this.siteUrl="http://cj.ffzyapi.com",this.remove18=!1,this.type_id_18=34}async spiderInit(e){e!==null?this.detailProxy=await js2Proxy(e,"detail",this.getHeader()):this.detailProxy=await js2Proxy(!0,this.siteType,this.siteKey,"detail/",this.getHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async parseVodShortListFromJson(e,n=!1){let r=[],i;for(let l of e.list)n?(i=new Ne,i.vod_pic=this.detailProxy+ti(l.vod_id),i.vod_id=l.vod_id,i.vod_name=l.vod_name,i.vod_remarks=l.vod_remarks):i=this.parseVodDetail(l),this.remove18&&l.type_id!==this.type_id_18&&r.push(i),!this.remove18&&l.type_id===this.type_id_18&&r.push(i);return r}parseVodDetail(e){let n=new Be;n.vod_id=e.vod_id,n.vod_name=e.vod_name,n.vod_pic=e.vod_pic,n.vod_remarks=e.vod_remarks,n.vod_area=e.vod_area,n.vod_year=e.vod_year,n.vod_actor=e.vod_actor,n.vod_director=e.vod_director;let r=$e(e.vod_content);return n.vod_content=r.text(),e.vod_down_url!==void 0&&e.vod_down_url.length>0&&(n.vod_play_from="\u76F4\u94FE\u64AD\u653E$$$",n.vod_play_url=e.vod_down_url+"$$$"),n.vod_play_from=n.vod_play_from+e.vod_play_from,n.vod_play_url=n.vod_play_url+e.vod_play_url,n.type_name=e.type_name,n}async parseVodDetailfromJson(e){let n,r=e.list;if(r.length>0){let i=r[0];n=this.parseVodDetail(i)}return n}async setClasses(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of n.class)r.type_pid!==0&&this.classes.push(this.getTypeDic(r.type_name,r.type_id))}async setFilterObj(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of this.classes){let i=r.type_id.toString();if(i!=="\u6700\u8FD1\u66F4\u65B0"){let l={key:"1",name:"\u5206\u7C7B",value:[{n:"\u5168\u90E8",v:i}]};for(let s of n.class){let a=s.type_name;a===this.type_name_18&&(this.type_id_18=s.type_id.toString()),this.remove18?s.type_pid===r.type_id&&a!==this.type_name_18&&l.value.push({n:a,v:s.type_id.toString()}):s.type_pid===r.type_id&&a===this.type_name_18&&l.value.push({n:a,v:s.type_id.toString()})}this.remove18?this.filterObj[i]=[l]:this.classes=[this.getTypeDic("\u6700\u8FD1\u66F4\u65B0","\u6700\u8FD1\u66F4\u65B0"),this.getTypeDic(this.type_name_18,this.type_id_18)]}}}async setHomeVod(){let e=await this.fetch(this.siteUrl+"/index.php/ajax/data",{mid:"1"},this.getHeader());this.homeVodList=await this.parseVodShortListFromJson(JSON.parse(e))}async setDetail(e){let n=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:e},this.getHeader());this.vodDetail=await this.parseVodDetailfromJson(JSON.parse(n))}async setCategory(e,n,r,i){e=i[1]??e;let l=this.siteUrl+`/index.php/ajax/data?mid=1&tid=${e}&page=${n}&limit=20`;await this.jadeLog.debug(`\u5206\u7C7BURL:${l}`);let s=await this.fetch(l,null,this.getHeader());await this.jadeLog.debug(`\u5206\u7C7B\u5185\u5BB9\u4E3A:${s}`),this.vodList=await this.parseVodShortListFromJson(JSON.parse(s))}async setSearch(e,n){let r=await this.fetch(this.siteUrl+"/api.php/provide/vod/",{wd:e},this.getHeader());this.vodList=await this.parseVodShortListFromJson(JSON.parse(r),!0)}async proxy(e,n){await this.jadeLog.debug(`\u6B63\u5728\u8BBE\u7F6E\u53CD\u5411\u4EE3\u7406 segments = ${e.join(",")},headers = ${JSON.stringify(n)}`);let r=e[0],i=vi(e[1]);if(await this.jadeLog.debug(`\u53CD\u5411\u4EE3\u7406\u53C2\u6570\u4E3A:${i}`),r==="detail"){let l=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:i},this.getHeader()),s=await this.parseVodDetailfromJson(JSON.parse(l)),a=await this.fetch(s.vod_pic,null,this.getHeader(),!1,!1,2);return B.isEmpty(a)?JSON.stringify({code:500,buffer:2,content:"",headers:{}}):JSON.stringify({code:200,buffer:2,content:a,headers:{}})}}};var zw=class extends uo{constructor(){super(),this.siteUrl="https://haiwaikan.com",this.remove18=!0,this.type_id_18=0}async spiderInit(e){await super.spiderInit(e)}async init(e){await super.init(e),await this.spiderInit(null)}getAppName(){return"\u6D77\u5916\u770B"}getName(){return"\u2615\u2503\u6D77\u5916\u770B\u2503\u2615\u5899"}getJSName(){return"haiwaikan"}getType(){return 3}async setClasses(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of n.class)r.type_id<26&&this.classes.push(this.getTypeDic(r.type_name,r.type_id.toString()));this.content_json=n}async getFilter(e,n){let r=[],i={key:"1",name:"\u5168\u90E8\u7C7B\u522B",value:[{n:"\u5168\u90E8\u7C7B\u522B",v:e.toString()}]};for(let l of n.class){let s=l.type_id,a=0,o=0;e===20&&(a=50,o=27),e===21&&(a=128,o=100),e===22&&(a=143,o=134),e===23&&(a=135,o=127),s<a&&s>o&&i.value.push({n:l.type_name,v:s.toString()})}return i.value.length>1?(r.push(i),r):null}async setFilterObj(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of this.classes){let i=r.type_id;if(i!=="\u6700\u8FD1\u66F4\u65B0"){let l=await this.getFilter(parseInt(i),n);l!==null&&(this.filterObj[i]=l)}}}},mn=new zw;var Gw=class extends Re{constructor(){super()}getName(){return mn.getName()}getAppName(){return mn.getAppName()}getJSName(){return mn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await mn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await mn.initCookie(e.server.config.bilicookie),await mn.spiderInit(e),mn.cfgObj.code=0,mn.catOpenStatus=!0,mn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await mn.setClasses(),this.classes=mn.classes}async setFilterObj(){await mn.setFilterObj(),this.filterObj=mn.filterObj}async setHomeVod(){await mn.setHomeVod(),this.homeVodList=mn.homeVodList}async setCategory(e,n,r,i){await mn.setCategory(e,n,r,i),this.vodList=mn.vodList}async setDetail(e){await mn.setDetail(e),this.vodDetail=mn.vodDetail}async setPlay(e,n,r){await mn.setPlay(e,n,r),this.playUrl=mn.playUrl,this.result=mn.result}async setSearch(e,n,r){await mn.setSearch(e,n,r),this.vodList=mn.vodList,this.result=mn.result}async setProxy(e,n){return await mn.proxy(e,n)}},co=new Gw;async function _K(t,e){return await co.init(t,e)}async function EK(t,e){return await co.home(t,e)}async function cxe(t,e){return await co.homeVod(t,e)}async function bK(t,e){return await co.category(t,e)}async function wK(t,e){return await co.detail(t,e)}async function SK(t,e){return await co.play(t,e)}async function TK(t,e){return await co.search(t,e)}async function pxe(t,e){return await co.proxy(t,e)}var xK={meta:{key:mn.getJSName(),name:mn.getName(),type:mn.getType()},api:async t=>{t.post("/init",_K),t.post("/home",EK),t.post("/category",bK),t.post("/detail",wK),t.post("/play",SK),t.post("/search",TK),t.get("/proxy/:what/:ids/:end",pxe)},spider:{init:_K,home:EK,homeVod:cxe,category:bK,detail:wK,play:SK,search:TK}};function vf(t,e){let n=_f();return vf=function(r,i){return r=r-424,n[r]},vf(t,e)}function _f(){let t=["1580630GngmmA","117uvwflw","join","current_id","565448Apkhig","23092JwmytW","707152yowhOv","getElementById","855936CGaczt","length","2966831GCGpvn","611266nfcTEf","value","substring"];return _f=function(){return t},_f()}(function(t,e){let n=vf,r=t();for(;;)try{if(-parseInt(n(436))/1+parseInt(n(429))/2+-parseInt(n(433))/3*(-parseInt(n(437))/4)+-parseInt(n(432))/5+parseInt(n(426))/6+parseInt(n(428))/7+parseInt(n(424))/8===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(_f,304089);function fxe(t,e){let n=vf,r=t,i=e;if(!r||!i)return;let l=r.length,s=r[n(431)](l-4,l),a=[];for(let o=0;o<s[n(427)];o++){let u=parseInt(s[o]),c=u%3+1;a[o]=i[n(431)](c,c+8),i=i[n(431)](c+8,i[n(427)])}return a[n(434)]("")}var Jw=class extends Fe{constructor(){super(),this.siteUrl="https://v.ikanbot.com"}getName(){return"\u{1F916}\u2503\u7231\u770B\u673A\u5668\u4EBA\u2503\u{1F916}"}getAppName(){return"\u7231\u770B\u673A\u5668\u4EBA"}getJSName(){return"ikanbot"}getType(){return 3}async spiderInit(e=null){e!==null?this.jsBase=await js2Proxy(e,"img",this.getHeader()):this.jsBase=await js2Proxy(!0,this.siteType,this.siteKey,"img/",this.getHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async parseVodShortListFromDoc(e){let n=[],r=e(e('[class="row list-wp"]')).find("a");for(let i of r){let l=new Ne,s=e(i).find("img")[0];l.vod_id=i.attribs.href,l.vod_pic=this.jsBase+ti(s.attribs["data-src"]),l.vod_name=s.attribs.alt,n.push(l)}return n}getChildren(e,n){try{return e[n].children[0].data}catch{return""}}async parseVodDetailFromDoc(e){let n=e("div.detail > .meta"),r=new Be;r.vod_pic=this.jsBase+ti(e("div.item-root > img")[0].attribs["data-src"]),r.vod_name=this.getChildren(n,0),r.vod_year=this.getChildren(n,1),r.vod_area=this.getChildren(n,3),r.vod_actor=this.getChildren(n,4);let i=Te(/<input type="hidden" id="current_id" value="(.*?)"/,e.html()),l=Te(/<input type="hidden" id="e_token" value="(.*?)"/,e.html()),s=Te(/<input type="hidden" id="mtype" value="(.*?)"/,e.html()),a={videoId:i,mtype:s,token:fxe(i,l)},o=await this.fetch(this.siteUrl+"/api/getResN",a,this.getHeader()),u=JSON.parse(o).data.list,c={},f=0,m=[];for(let d of u){let y=JSON.parse(d.resData);for(let _ of y){f=f+1;let S=_.flag,w=_.url;!S||!w||c[S]||(m.push(`\u7EBF\u8DEF${f}`),c[S]=w)}}return r.vod_play_from=m.join("$$$"),r.vod_play_url=B.values(c).join("$$$"),r}async parseVodShortListFromDocBySearch(e){let n=[],r=e("div.media > div.media-left > a");for(let i of r){let l=new Ne,s=e(i).find("img:first")[0];l.vod_id=i.attribs.href,l.vod_name=s.attribs.alt,l.vod_pic=this.jsBase+ti(s.attribs["data-src"]),n.push(l)}return n}async setClasses(){let e=await this.fetch(this.siteUrl+"/category",null,this.getHeader());if(!B.isEmpty(e)){let n=$e(e),r=n(n(n('[class="row visible-xs-block visible-sm-block"]')).find("li")).find("a");for(let i of r)this.classes.push({type_name:n(i).text(),type_id:i.attribs.href})}}async setFilterObj(){for(let e of this.classes.slice(1,9)){let n=e.type_id;if(n.indexOf("category")===-1||n.indexOf(",")>-1){let r=n.split(",").slice(-1)[0],i=await this.fetch(this.siteUrl+r,null,this.getHeader());if(!B.isEmpty(i)){let l=$e(i),s=l('[class="row visible-xs-block visible-sm-block"]'),a=s.find('[class="nav nav-pills"]').find("a"),o=[];n.indexOf(",")>-1&&o.push({n:"\u5168\u90E8",v:n.split(",")[0]});let u={key:n,name:l(s.find("h5")).text(),value:o};for(let c of a)o.push({n:l(c).text(),v:c.attribs.href});o.length>0&&(this.filterObj[n]=[u])}}}}async setHomeVod(){let e=await this.fetch(this.siteUrl,null,this.getHeader());if(!B.isEmpty(e)){let n=$e(e);this.homeVodList=await this.parseVodShortListFromDoc(n)}}async setCategory(e,n,r,i){let l=this.siteUrl+(i[e]||e.split(",")[0]),s=!1;l.indexOf("html")>-1?l=l.replace(".html",n>1?`-p-${n}.html`:".html"):(l=l+`?p=${n}`,s=!0),await this.jadeLog.debug(`\u5206\u7C7BURL:${l}`);let a=await this.fetch(l,null,this.getHeader());if(!B.isEmpty(a)){let o=$e(a);this.vodList=await this.parseVodShortListFromDoc(o);let u=o("div.page-more > a:contains(\u4E0B\u4E00\u9875)");s&&(this.page=parseInt(u[0].attribs.href.split("p=")[1]));let c=u.length>0;this.limit=24,this.count=c?parseInt(n)+1:parseInt(n),this.total=this.limit*this.count}}async setDetail(e){let n=await this.fetch(this.siteUrl+e,null,this.getHeader());if(!B.isEmpty(n)){let r=$e(n);this.vodDetail=await this.parseVodDetailFromDoc(r)}}async setSearch(e,n){let r=await this.fetch(this.siteUrl+"/search?q="+e,null,this.getHeader());if(!B.isEmpty(r)){let i=$e(r);this.vodList=await this.parseVodShortListFromDocBySearch(i)}}async setPlay(e,n,r){this.playUrl=n}},yn=new Jw;var Kw=class extends Re{constructor(){super()}getName(){return yn.getName()}getAppName(){return yn.getAppName()}getJSName(){return yn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await yn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await yn.initCookie(e.server.config.bilicookie),await yn.spiderInit(e),yn.cfgObj.code=0,yn.catOpenStatus=!0,yn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await yn.setClasses(),this.classes=yn.classes}async setFilterObj(){await yn.setFilterObj(),this.filterObj=yn.filterObj}async setHomeVod(){await yn.setHomeVod(),this.homeVodList=yn.homeVodList}async setCategory(e,n,r,i){await yn.setCategory(e,n,r,i),this.vodList=yn.vodList}async setDetail(e){await yn.setDetail(e),this.vodDetail=yn.vodDetail}async setPlay(e,n,r){await yn.setPlay(e,n,r),this.playUrl=yn.playUrl,this.result=yn.result}async setSearch(e,n,r){await yn.setSearch(e,n,r),this.vodList=yn.vodList,this.result=yn.result}async setProxy(e,n){return await yn.proxy(e,n)}},po=new Kw;async function AK(t,e){return await po.init(t,e)}async function OK(t,e){return await po.home(t,e)}async function dxe(t,e){return await po.homeVod(t,e)}async function NK(t,e){return await po.category(t,e)}async function CK(t,e){return await po.detail(t,e)}async function RK(t,e){return await po.play(t,e)}async function IK(t,e){return await po.search(t,e)}async function hxe(t,e){return await po.proxy(t,e)}var kK={meta:{key:yn.getJSName(),name:yn.getName(),type:yn.getType()},api:async t=>{t.post("/init",AK),t.post("/home",OK),t.post("/category",NK),t.post("/detail",CK),t.post("/play",RK),t.post("/search",IK),t.get("/proxy/:what/:ids/:end",hxe)},spider:{init:AK,home:OK,homeVod:dxe,category:NK,detail:CK,play:RK,search:IK}};var Xw=class extends Fe{constructor(){super(),this.siteUrl="https://ali.gitcafe.ink"}getName(){return"\u{1F98A}\u2503\u963F\u91CC\u7EB8\u6761\u2503\u{1F98A}"}getAppName(){return"\u963F\u91CC\u7EB8\u6761"}getJSName(){return"gitcafe"}getType(){return 3}async getApiUrl(){let e=await this.fetch(this.siteUrl,null,this.getHeader());if(!B.isEmpty(e)){let n=Te(/<script src='(.*?)'><\/script>/,e),r=await this.fetch(n,null,this.getHeader());return{api:"https:"+Te(/ return '(.*?)' \+ /,r)+new Date().getTime(),search_api:Te(/const SEARCH_API = '(.*?)';/,r)}}}async getContentJson(){let e=await this.getApiUrl(),n=await this.fetch(e.api,null,this.getHeader());if(this.search_api=e.search_api,!B.isEmpty(n))return JSON.parse(n)}async spiderInit(){this.content_json=await this.getContentJson(),this.token_dic=await this.load_cache()}async init(e){await this.spiderInit(),await super.init(e),await qi(this.cfgObj.token)}async parseClassFromJson(e){let n=Object.keys(e.data).slice(0,19);for(let r of n)this.classes.push({type_name:e.data[r].name,type_id:r})}async parseVodShortListFromJson(e){let n=[],r=this.getClassIdList();for(let i of e){let l=new Ne;r.includes(i.cat)&&(l.vod_id=JSON.stringify(i),l.vod_name=i.title,l.vod_remarks=i.date,n.push(l))}return n}async parseVodDetailfromJson(e){let n=this.getClassNameList(),r=this.getClassIdList(),i=new Be;i.vod_name=e.title,i.vod_remarks=e.creatime??e.date,i.type_name=n[r.indexOf(e.cat)],i.vod_content=e.des;let l="https://www.aliyundrive.com/s/"+e.alikey,s=await Tl([l]);return i.vod_play_url=s.vod_play_url,i.vod_play_from=s.vod_play_from,i}async setClasses(){await this.parseClassFromJson(this.content_json)}async setHomeVod(){this.homeVodList=await this.parseVodShortListFromJson(this.content_json.info.new)}async setDetail(e){let n=JSON.parse(e);this.vodDetail=await this.parseVodDetailfromJson(n)}async setCategory(e,n,r,i){this.vodList=await this.parseVodShortListFromJson(this.content_json.data[e].catdata)}async setSearch(e,n){await this.refreshToken();let r={action:"search",from:"web",token:this.token_dic.token,keyword:e},i=await this.post(this.search_api,r,this.getHeader());if(!B.isEmpty(i)){let l=JSON.parse(i);this.vodList=await this.parseVodShortListFromJson(l.data)}}async refreshToken(){let e=new Date().getTime();B.isEmpty(this.token_dic.token)?(await this.get_token(),await this.jadeLog.debug("Token\u4E3A\u7A7A,\u5237\u65B0Token")):e-parseInt(this.token_dic.date)>24*60*60*1e3?(await this.jadeLog.debug(`Token\u5230\u671F,\u4E0A\u6B21\u83B7\u53D6Token\u65F6\u95F4\u4E3A:${e},\u5F53\u524D\u65F6\u95F4\u4E3A:${parseInt(this.token_dic.date)},\u5237\u65B0Token`),await this.get_token()):await this.jadeLog.debug("Token\u4ECD\u7136\u6709\u6548,\u65E0\u9700\u5237\u65B0",!0)}async get_token(){try{let e={action:"get_token",from:"web"},n=await this.post(this.search_api,e,this.getHeader());if(!B.isEmpty(n)){let r=JSON.parse(n),i=new Date().getTime();this.token_dic.token=r.data,this.token_dic.date=i.toString(),await this.write_cache()}}catch(e){await this.jadeLog.error("\u83B7\u53D6Token\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+e)}}async write_cache(){await local.set("gitcafe_token","token",JSON.stringify(this.token_dic))}async load_cache(){try{let e=await local.get("gitcafe_token","token");return JSON.parse(e)}catch{return{token:"",date:""}}}async play(e,n,r){return await xl(e,n,r)}},gn=new Xw;var Ww=class extends Re{constructor(){super()}getName(){return gn.getName()}getAppName(){return gn.getAppName()}getJSName(){return gn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await gn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await gn.initCookie(e.server.config.bilicookie),await gn.spiderInit(e),gn.cfgObj.code=0,gn.catOpenStatus=!0,gn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await gn.setClasses(),this.classes=gn.classes}async setFilterObj(){await gn.setFilterObj(),this.filterObj=gn.filterObj}async setHomeVod(){await gn.setHomeVod(),this.homeVodList=gn.homeVodList}async setCategory(e,n,r,i){await gn.setCategory(e,n,r,i),this.vodList=gn.vodList}async setDetail(e){await gn.setDetail(e),this.vodDetail=gn.vodDetail}async setPlay(e,n,r){await gn.setPlay(e,n,r),this.playUrl=gn.playUrl,this.result=gn.result}async setSearch(e,n,r){await gn.setSearch(e,n,r),this.vodList=gn.vodList,this.result=gn.result}async setProxy(e,n){return await gn.proxy(e,n)}},fo=new Ww;async function DK(t,e){return await fo.init(t,e)}async function PK(t,e){return await fo.home(t,e)}async function mxe(t,e){return await fo.homeVod(t,e)}async function LK(t,e){return await fo.category(t,e)}async function FK(t,e){return await fo.detail(t,e)}async function jK(t,e){return await fo.play(t,e)}async function UK(t,e){return await fo.search(t,e)}async function yxe(t,e){return await fo.proxy(t,e)}var MK={meta:{key:gn.getJSName(),name:gn.getName(),type:gn.getType()},api:async t=>{t.post("/init",DK),t.post("/home",PK),t.post("/category",LK),t.post("/detail",FK),t.post("/play",jK),t.post("/search",UK),t.get("/proxy/:what/:ids/:end",yxe)},spider:{init:DK,home:PK,homeVod:mxe,category:LK,detail:FK,play:jK,search:UK}};var z5=class extends Fe{constructor(){super(),this.siteUrl="http://op.ysdqjs.cn",this.cookie="",this.extendObj={extend:"\u7C7B\u578B",area:"\u5730\u533A",lang:"\u8BED\u8A00",year:"\u5E74\u4EE3"},this.parseMap={}}async request(e,n,r){let i={"User-Agent":zr};B.isEmpty(this.cookie)||(i.Cookie=this.cookie);let l=n==="post"?"form-data":"",s=await req(e,{method:n||"get",headers:i,data:r,postType:l});if(s.code===403){let a=s.data.match(/window\.location\.href ="(.*?)"/)[1];this.cookie=B.isArray(s.headers["set-cookie"])?s.headers["set-cookie"].join(";"):s.headers["set-cookie"],i.Cookie=this.cookie,s=await req(this.siteUrl+a,{method:n||"get",headers:i,data:r,postType:l})}return s.content}async postData(e,n){let r=Math.floor(new Date().getTime()/1e3),s={sign:md5X("kj5649ertj84ks89r4jh8s45hf84hjfds04k"+r).toString(),timestamp:r},a=n?B.merge(s,n):s;return await this.request(e,"post",a)}getName(){return"\u26C4\u2503\u5929\u5929\u5F71\u89C6\u2503\u26C4"}getAppName(){return"\u5929\u5929\u5F71\u89C6"}getJSName(){return"tiantian"}getType(){return 3}async init(e){await super.init(e),this.danmuStaus=!1}generateParam(e,n,r,i){let l={type_id:e,page:n,limit:i};return r.class&&(l.class=r.class),r.area&&(l.area=r.area),r.lang&&(l.lang=r.lang),r.year&&(l.year=r.year),l}async getFilter(e){let n=[];return Object.keys(e).forEach(r=>{if(Array.isArray(e[r])){let i={key:r,name:this.extendObj[r],value:[]};for(let l of e[r])i.value.push({n:l,v:l});n.push(i)}}),n}async setClasses(){let e=JSON.parse(await this.postData(this.siteUrl+"/v2/type/top_type"));for(let n of e.data.list){let r=n.type_name,i=n.type_id.toString();this.classes.push(this.getTypeDic(r,i)),this.filterObj[i]=await this.getFilter(n)}}async parseVodShortListFromJson(e){let n=[];for(let r of e){let i=new Ne;i.load_data(r),B.isEmpty(i.vod_pic)&&r.vod_pic_thumb!==void 0&&(i.vod_pic=r.vod_pic_thumb),i.vod_name!=="\u9996\u9875\u8F6E\u64AD"&&n.push(i)}return n}async parseVodDetailfromJson(e){let n=new Be;n.load_data(e),n.vod_content=Ep(n.vod_content);let r=e.vod_play_list,i={};return B.each(r,l=>{let s=l.name,a="",o=l.urls,u=l.parse_urls;B.isEmpty(u)||(this.parseMap[s]=u);let c=B.map(o,f=>{let m=f.name,d=f.url;return m+"$"+d});B.isEmpty(c)||(a=c.join("#"),i[s]=a)}),n.vod_play_from=B.keys(i).join("$$$"),n.vod_play_url=B.values(i).join("$$$"),n}async setHomeVod(){let e=JSON.parse(await this.postData(this.siteUrl+"/v2/type/tj_vod")),n=[];for(let r of e.data.type_vod)r.type_name!=="\u5E7F\u544A"&&(n=await this.parseVodShortListFromJson(r.vod),this.homeVodList=[...this.homeVodList,...n]);n=await this.parseVodShortListFromJson(e.data.loop),this.homeVodList=[...this.homeVodList,...n],n=await this.parseVodShortListFromJson(e.data.cai),this.homeVodList=[...this.homeVodList,...n]}async setCategory(e,n,r,i){let s=this.generateParam(e,n,i,12),a=JSON.parse(await this.postData(this.siteUrl+"/v2/home/type_search",s));this.vodList=await this.parseVodShortListFromJson(a.data.list)}async setDetail(e){let n={vod_id:e},r=JSON.parse(await this.postData(this.siteUrl+"/v2/home/vod_details",n));this.vodDetail=await this.parseVodDetailfromJson(r.data)}async setPlay(e,n,r){let i=this.parseMap[e];if((e.indexOf("\u8292\u679C")>-1||e.indexOf("\u817E\u8BAF")>-1||e.indexOf("\u7231\u5947\u827A")>-1)&&(this.danmuStaus=!0,this.catOpenStatus||(this.danmuUrl=await this.danmuSpider.downloadDanmu("https://dmku.thefilehosting.com/?ac=dm&url="+n))),!B.isEmpty(i)){for(let l of i)if(!B.isEmpty(l))try{let s=await this.request(l+n),a=JSON.parse(s);if(!B.isEmpty(a.url)){this.playUrl=a.url;break}}catch{}}}async setSearch(e,n,r){let l={keyword:e,page:r,limit:12},s=JSON.parse(await this.postData(this.siteUrl+"/v2/home/search",l));this.vodList=await this.parseVodShortListFromJson(s.data.list);let a=parseInt(r),o=a;this.vodList.length===12&&(o=a+1),this.result.setPage(a,o,12,o)}},vn=new z5;var Yw=class extends Re{constructor(){super()}getName(){return vn.getName()}getAppName(){return vn.getAppName()}getJSName(){return vn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await vn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await vn.initCookie(e.server.config.bilicookie),await vn.spiderInit(e),vn.cfgObj.code=0,vn.catOpenStatus=!0,vn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await vn.setClasses(),this.classes=vn.classes}async setFilterObj(){await vn.setFilterObj(),this.filterObj=vn.filterObj}async setHomeVod(){await vn.setHomeVod(),this.homeVodList=vn.homeVodList}async setCategory(e,n,r,i){await vn.setCategory(e,n,r,i),this.vodList=vn.vodList}async setDetail(e){await vn.setDetail(e),this.vodDetail=vn.vodDetail}async setPlay(e,n,r){await vn.setPlay(e,n,r),this.playUrl=vn.playUrl,this.result=vn.result}async setSearch(e,n,r){await vn.setSearch(e,n,r),this.vodList=vn.vodList,this.result=vn.result}async setProxy(e,n){return await vn.proxy(e,n)}},ho=new Yw;async function $K(t,e){return await ho.init(t,e)}async function BK(t,e){return await ho.home(t,e)}async function gxe(t,e){return await ho.homeVod(t,e)}async function HK(t,e){return await ho.category(t,e)}async function VK(t,e){return await ho.detail(t,e)}async function qK(t,e){return await ho.play(t,e)}async function zK(t,e){return await ho.search(t,e)}async function vxe(t,e){return await ho.proxy(t,e)}var GK={meta:{key:vn.getJSName(),name:vn.getName(),type:vn.getType()},api:async t=>{t.post("/init",$K),t.post("/home",BK),t.post("/category",HK),t.post("/detail",VK),t.post("/play",qK),t.post("/search",zK),t.get("/proxy/:what/:ids/:end",vxe)},spider:{init:$K,home:BK,homeVod:gxe,category:HK,detail:VK,play:qK,search:zK}};var Qw="abacdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789";function Ef(t,e){let n="",r=e===void 0?!0:e;for(let i=0;i<t;i++){let l=B.random(0,r?Qw.length-1:Qw.length-11);n+=Qw[l]}return n}function _xe(){return{brand:"Huawei",model:"HUAWEI Mate 20",release:"10",buildId:Ef(3,!1).toUpperCase()+B.random(11,99)+Ef(1,!1).toUpperCase()}}function Exe(t,e){return e.trim().replaceAll(t,"").replace(/<|>|《|》/g,"").replace(/\$|#/g," ").trim()}function JK(t,e){try{let n=e.url??"";if(n.startsWith("//")&&(n="https:"+n),!n.startsWith("http"))return{};let r=e.headers||{},i=(e["user-agent"]||"").trim();i.length>0&&(r["User-Agent"]=i);let l=(e.referer||"").trim();return l.length>0&&(r.Referer=l),B.keys(r).forEach(s=>{r[s]||delete r[s]}),{header:r,url:n}}catch{}return{}}var Zw=class extends Fe{constructor(){super(),this.siteUrl="https://api1.baibaipei.com:8899",this.device={},this.parse=[]}getName(){return"\u{1F6E5}\uFE0E\u2503\u5FEB\u770B\u89C6\u9891\u2503\u{1F6E5}\uFE0E"}getAppName(){return"\u5FEB\u770B\u89C6\u9891"}getJSName(){return"kuaikan"}getType(){return 3}async init(e){await super.init(e),this.danmuStaus=!0,await this.setDevice()}async request(e,n,r,i){let l=DV().valueOf().toString(),s=Ef(32),a=Ve.enc.Hex.stringify(Ve.MD5("H58d2%gLbeingX*%D4Y8!C!!@G_"+l+"_"+s)).toString().toLowerCase(),o={"user-agent":r||this.device.ua};e.includes("baibaipei")&&(o["device-id"]=this.device.id,o.sign=a,o.time=l,o.md5=s,o.version="2.1.5",o["system-model"]=this.device.model,o["system-brand"]=this.device.brand,o["system-version"]=this.device.release,o.host="api1.baibaipei.com:8899"),i||(o["Content-Type"]="application/x-www-form-urlencoded");let u=await req(e,{method:i?"get":"post",headers:o,data:n||{},postType:"form"});await this.jadeLog.debug(`URL:${e},headers:${JSON.stringify(o)},data:${[JSON.stringify(n)]}`);let c=u.content;try{let f=Ve.enc.Utf8.parse("IjhHsCB2B5^#%0Ag"),m=Ve.enc.Utf8.parse("y8_m.3rauW/>j,}."),d=Ve.enc.Base64.parse(c),y=Ve.AES.decrypt({ciphertext:d},f,{iv:m,padding:Ve.pad.Pkcs7});return y=Ve.enc.Utf8.stringify(y),await this.jadeLog.debug(`response:${y}`),JSON.parse(y)}catch{return JSON.parse(c)}}async setDevice(){let e="device",n=await local.get(this.siteKey,e);if(n.length>0)try{this.device=JSON.parse(n)}catch{}B.isEmpty(this.device)&&(this.device=_xe(),this.device.id=Ef(13).toLowerCase(),this.device.ua="okhttp/3.14.9",await local.set(this.siteKey,e,JSON.stringify(this.device)))}async setClasses(){await this.setDevice();let e=await this.request(this.siteUrl+"/api.php/Index/getTopVideoCategory");for(let n of e.data){let r=n.nav_name;if(r==="\u63A8\u8350")continue;let i=n.nav_type_id.toString();this.classes.push({type_id:i,type_name:r})}}async getFilter(e){await this.jadeLog.debug(JSON.stringify(e));let n=[];for(let r of Object.keys(e)){let i=e[r];r==="plot"&&(r="class");let l="";switch(r){case"class":l="\u7C7B\u578B";break;case"area":l="\u5730\u533A";break;case"lang":l="\u8BED\u8A00";break;case"year":l="\u5E74\u4EE3";break;case"sort":l="\u6392\u5E8F";break}if(l.length===0)continue;let s={key:r,name:l},a=[];for(let o=0;o<i.length;o++){let u=i[o],c=r==="sort"?o+"":u==="\u5168\u90E8"?"0":u;a.push({n:u,v:c})}s.init=r==="sort"?"1":a[0].v,s.value=a,n.push(s)}return n}async setFilterObj(){for(let e of this.classes){let n=e.type_id;if(n!=="\u6700\u8FD1\u66F4\u65B0"){let r=await this.request(this.siteUrl+"/api.php/Video/getFilterType",{type:n});this.filterObj[n]=await this.getFilter(r.data)}}}async parseVodShortListFromJSONByHome(e){let n=[];for(let r of e.video){let i=await this.parseVodShortListFromJson(r.list);n.push(...i)}return n}async parseVodShortListFromJson(e){let n=[];for(let r of e){let i=new Ne;i.vod_id=r.vod_id,i.vod_name=r.vod_name,i.vod_pic=r.vod_pic,i.vod_remarks=r.vod_remarks,n.push(i)}return n}async parseVodDetailfromJson(e){let n=new Be;n.load_dic(JSON.stringify(e)),n.vod_content=e.vod_content.trim(),n.type_name=e.vod_class;let r={};for(let s of e.vod_play){let a=s.playerForm;if(a==="jp"&&this.catOpenStatus||a==="xg"&&this.catOpenStatus)continue;let o=[];for(let u of s.url)o.push(Exe(n.vod_name,u.title)+"$"+u.play_url);!r.hasOwnProperty(a)&&o.length>0&&(r[a]=o)}this.parse=e.parse||[],n.vod_play_from=B.keys(r).join("$$$");let i=B.values(r),l=[];for(let s of i)l.push(s.join("#"));return n.vod_play_url=l.join("$$$"),n}async setHomeVod(){let e=await this.request(this.siteUrl+"/api.php/Index/getHomePage",{p:"1",type:"1"});this.homeVodList=await this.parseVodShortListFromJSONByHome(e.data)}async setCategory(e,n,r,i){n===0&&(n=1);let l=this.siteUrl+"/api.php/Video/getFilterVideoList",s=JSON.parse(iu(`{
`+t)}globalThis.req=axe;async function axe(t,e){try{let n=e&&e.data||null,r=e&&e.postType||null,i=e&&e.buffer||0,l=e&&e.timeout||5e3,s=(e&&e.redirect||1)===1,a=e.proxy??!1,o=e?e.headers||{}:{};r==="form"?(o["Content-Type"]="application/x-www-form-urlencoded",n!=null&&(n=mK.default.stringify(n,{encode:!1}))):r==="form-data"&&(o["Content-Type"]="multipart/form-data",n=oK(n));let u=i===1||i===2?"arraybuffer":void 0,c;a?c=vK.default.httpsOverHttp({proxy:{host:"127.0.0.1",port:7890}}):c=yK.default.Agent({rejectUnauthorized:!1});let f=await L0(t,{responseType:u,method:e&&e.method||"get",headers:o,data:n,timeout:l,maxRedirects:s?null:0,httpsAgent:c});n=f.data;let m={};for(let d of f.headers){let y=d[1];m[d[0]]=Array.isArray(y)&&y.length===1?y[0]:y}if(!i)typeof n=="object"&&(n=JSON.stringify(n));else{if(i===1)return{code:f.status,headers:m,content:n};if(i===2)return{code:f.status,headers:m,content:n.toString("base64")};if(i===3){let d=e.stream;return d.onResp&&await d.onResp({code:f.status,headers:m}),d.onData?(n.on("data",async y=>{await d.onData(y)}),n.on("end",async()=>{d.onDone&&await d.onDone()})):d.onDone&&await d.onDone(),"stream..."}}return{code:f.status,headers:m,content:n}}catch(n){let r=n.response;try{return{code:r.status,headers:r.headers,content:JSON.stringify(r.data)}}catch{return{headers:{},content:""}}}}globalThis.md5X=oxe;function oxe(t){return gK.default.createHash("md5").update(Buffer.from(t,"utf8")).digest("hex")}globalThis.js2Proxy=function(t,e,n){let r=Object.keys(n).length===0?" ":encodeURIComponent(JSON.stringify(n));return t.server.address().dynamic+t.server.prefix+"/proxy/"+encodeURIComponent(e)+"/"+r+"/"};var uxe=["DEBUG","INFO","WARNING","ERROR"];var j0=class{constructor(e,n="DEBUG"){this.app_name=e,this.level=n,this.level_index=uxe.indexOf(n)}format(e,n){let r=80;switch(e){case"INFO":r=r+1;break;case"WARNING":r=r-2;break;default:break}return n.length<r&&((r-n.length)%2===0?n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)):n="#".repeat(Math.floor((r-n.length)/2))+n+"#".repeat(Math.floor((r-n.length)/2)+1)),n}getTime(){let e=new Date;return e.toLocaleDateString().replace(/\//g,"-")+" "+e.toTimeString().substr(0,8)+","+e.getMilliseconds().toString()}formatMessage(e,n,r){return r&&(n=this.format(e,n)),`${this.getTime()} - ${this.app_name} - ${e}: ${n}`}async log(e){console.debug(e),await req("http://127.0.0.1:8099/upload",{data:{log:e+`
`},timeout:.1})}async info(e,n){this.level_index<=1&&await this.log(this.formatMessage("INFO",e,n))}async warning(e,n){this.level_index<=2&&await this.log(this.formatMessage("WARNING",e,n))}async error(e,n){this.level_index<=3&&await this.log(this.formatMessage("ERROR",e,n))}async debug(e,n){this.level_index<=0&&await this.log(this.formatMessage("DEBUG",e,n))}};var Re=class extends Fe{constructor(){super(),this.jadeLog=new j0(this.getAppName(),"DEBUG")}async init(e,n){await this.jadeLog.info("\u521D\u59CB\u5316",!0);try{await await req("http://127.0.0.1:8099/clear",{timeout:.1}),this.siteKey=this.getJSName(),this.siteType=this.getType(),this.cfgObj=e.server.config[this.siteKey],this.deviceKey=e.server.prefix+"/",this.db=e.server.db,this.catOpenStatus=!0,this.danmuStaus=!1;try{await this.loadFilterAndClasses()?await this.jadeLog.debug("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u6210\u529F"):(await this.jadeLog.warning("\u8BFB\u53D6\u7F13\u5B58\u5217\u8868\u548C\u4E8C\u7EA7\u83DC\u5355\u5931\u8D25"),await this.writeFilterAndClasses())}catch(r){await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),await this.jadeLog.error("\u8BFB\u53D6\u7F13\u5B58\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+r,!1)}}catch(r){await this.jadeLog.error(`\u521D\u59CB\u5316\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}await this.jadeLog.info("\u521D\u59CB\u5316\u5B8C\u6210",!0)}async loadFilterAndClasses(){return this.classes=await this.getClassesCache(),this.filterObj=await this.getFiletObjCache(),this.classes.length>0?!0:(await this.db.push(this.deviceKey+"classes",{}),await this.db.push(this.deviceKey+"filterObj",{}),!1)}async writeFilterAndClasses(){this.catOpenStatus&&this.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await this.setClasses(),await this.setFilterObj(),await this.db.push(this.deviceKey+"classes",this.classes),await this.db.push(this.deviceKey+"filterObj",this.filterObj)}async getClassesCache(){let e=await this.db.getObjectDefault(this.deviceKey+"classes",{});return B.isEmpty(e)?this.classes:e}async getFiletObjCache(){let e=await this.db.getObjectDefault(this.deviceKey+"filterObj",{});return B.isEmpty(e)?this.filterObj:e}async home(e,n){return this.vodList=[],await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u7C7B\u522B",!0),await this.setHome(),await this.jadeLog.debug(`\u9996\u9875\u7C7B\u522B\u5185\u5BB9\u4E3A:${this.result.home(this.classes,[],this.filterObj)}`),await this.jadeLog.info("\u9996\u9875\u7C7B\u522B\u89E3\u6790\u5B8C\u6210",!0),this.result.home(this.classes,[],this.filterObj)}async homeVod(){await this.jadeLog.info("\u6B63\u5728\u89E3\u6790\u9996\u9875\u5185\u5BB9",!0);try{return await this.setHomeVod(),await this.jadeLog.debug(`\u9996\u9875\u5185\u5BB9\u4E3A:${this.result.homeVod(this.homeVodList)}`),await this.jadeLog.info("\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5B8C\u6210",!0),this.result.homeVod(this.homeVodList)}catch(e){await this.jadeLog.error(`\u9996\u9875\u5185\u5BB9\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${e}`)}}async category(e,n){let r=e.body.id,i=e.body.page,l=!0,s=e.body.filters;if(this.page=parseInt(i),await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u5206\u7C7B\u9875\u9762,tid = ${r},pg = ${i},extend = ${JSON.stringify(s)}`),r==="\u6700\u8FD1\u66F4\u65B0")return this.page=0,await this.homeVod();try{return this.vodList=[],await this.setCategory(r,i,l,s),await this.jadeLog.debug(`\u5206\u7C7B\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}`),await this.jadeLog.info("\u5206\u7C7B\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.category(this.vodList,this.page,this.count,this.limit,this.total)}catch(a){await this.jadeLog.error(`\u5206\u7C7B\u9875\u89E3\u6790\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${a}`)}}async detail(e,n){await this.jadeLog.debug(`\u83B7\u53D6\u8BE6\u60C5\u9875\u9762:${JSON.stringify(e.body)}`);let i=(Array.isArray(e.body.id)?e.body.id:[e.body.id])[0];this.vodDetail=new Be,await this.jadeLog.info(`\u6B63\u5728\u83B7\u53D6\u8BE6\u60C5\u9875\u9762,id\u4E3A:${i}`);try{return await this.setDetail(i),await this.jadeLog.debug(`\u8BE6\u60C5\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.detail(this.vodDetail)}`),await this.jadeLog.info("\u8BE6\u60C5\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.vodDetail.vod_id=i,this.result.detail(this.vodDetail)}catch(l){await this.jadeLog.error("\u8BE6\u60C5\u754C\u9762\u83B7\u53D6\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+l)}}async play(e,n){let r=e.body.flag,i=e.body.id,l=[];await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u64AD\u653E\u9875\u9762,flag:${r},id:${i},flags:${l}`,!0);try{let s;if(await this.setPlay(r,i,l),this.playUrl.content!==void 0)return this.playUrl;if(await this.jadeLog.debug("\u4E0D\u9700\u8981\u52A0\u8F7D\u5F39\u5E55",!0),this.result.jx===1&&this.playUrl.indexOf(".m3u8")<0){let a=await e.server.messageToDart({action:"sniff",opt:{url:i,timeout:6e4,rule:"http((?!http).){12,}?\\.m3u8?"}});if(a&&a.url){let o={};a.headers&&(a.headers["user-agent"]&&(o["User-Agent"]=a.headers["user-agent"]),a.headers.referer&&(o.Referer=a.headers.referer)),await this.jadeLog.debug(`\u55C5\u63A2\u6210\u529F,\u64AD\u653E\u8FDE\u63A5\u4E3A:${a.url}`),s=JSON.stringify({parse:0,url:a.url,header:a.headers,jx:"0"})}else await this.jadeLog.error("\u89E3\u6790\u5931\u8D25,\u65E0\u6CD5\u55C5\u63A2\u5230\u64AD\u653E\u8FDE\u63A5"),s=JSON.stringify({parse:0,url:"",jx:"0"})}else s=this.result.play(this.playUrl);return await this.jadeLog.info("\u64AD\u653E\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),await this.jadeLog.debug(`\u64AD\u653E\u9875\u9762\u5185\u5BB9\u4E3A:${s}`),s}catch(s){await this.jadeLog.error("\u89E3\u6790\u64AD\u653E\u9875\u9762\u51FA\u9519,\u5931\u8D25\u539F\u56E0\u4E3A:"+s)}}async search(e,n){let r=e.body.page,i=e.body.wd,l=!0;return this.vodList=[],await this.jadeLog.info(`\u6B63\u5728\u89E3\u6790\u641C\u7D22\u9875\u9762,\u5173\u952E\u8BCD\u4E3A = ${i},quick = ${l},pg = ${r}`),await this.setSearch(i,l,r),this.vodList.length===0&&i.indexOf(" ")>-1&&(await this.jadeLog.debug(`\u641C\u7D22\u5173\u952E\u8BCD\u4E3A:${i},\u5176\u4E2D\u6709\u7A7A\u683C,\u53BB\u9664\u7A7A\u683C\u5728\u641C\u7D22\u4E00\u6B21`),await this.search(i.replaceAll(" ","").replaceAll("?",""),l)),await this.jadeLog.debug(`\u641C\u7D22\u9875\u9762\u5185\u5BB9\u4E3A:${this.result.search(this.vodList)}`),await this.jadeLog.info("\u641C\u7D22\u9875\u9762\u89E3\u6790\u5B8C\u6210",!0),this.result.search(this.vodList)}async proxy(e,n){try{let r=e.params.what,i={};try{i=JSON.parse(e.params.ids)}catch{}let l=decodeURIComponent(e.params.end),s=JSON.parse(await this.setProxy([r,l],i));return r==="dash"?(await this.jadeLog.debug(`dash:${JSON.stringify(s)}`),n.code(s.code).headers(s.headers),s.content):s.code===200?(n.code(s.code).headers(s.headers),Buffer.from(s.content,"base64")):(n.code(500),"")}catch(r){await this.jadeLog.error(`\u4EE3\u7406\u56DE\u8C03\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:${r}`)}}};var uo=class extends Fe{constructor(){super(),this.siteUrl="http://cj.ffzyapi.com",this.remove18=!1,this.type_id_18=34}async spiderInit(e){e!==null?this.detailProxy=await js2Proxy(e,"detail",this.getHeader()):this.detailProxy=await js2Proxy(!0,this.siteType,this.siteKey,"detail/",this.getHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async parseVodShortListFromJson(e,n=!1){let r=[],i;for(let l of e.list)n?(i=new Ne,i.vod_pic=this.detailProxy+ti(l.vod_id),i.vod_id=l.vod_id,i.vod_name=l.vod_name,i.vod_remarks=l.vod_remarks):i=this.parseVodDetail(l),this.remove18&&l.type_id!==this.type_id_18&&r.push(i),!this.remove18&&l.type_id===this.type_id_18&&r.push(i);return r}parseVodDetail(e){let n=new Be;n.vod_id=e.vod_id,n.vod_name=e.vod_name,n.vod_pic=e.vod_pic,n.vod_remarks=e.vod_remarks,n.vod_area=e.vod_area,n.vod_year=e.vod_year,n.vod_actor=e.vod_actor,n.vod_director=e.vod_director;let r=$e(e.vod_content);return n.vod_content=r.text(),e.vod_down_url!==void 0&&e.vod_down_url.length>0&&(n.vod_play_from="\u76F4\u94FE\u64AD\u653E$$$",n.vod_play_url=e.vod_down_url+"$$$"),n.vod_play_from=n.vod_play_from+e.vod_play_from,n.vod_play_url=n.vod_play_url+e.vod_play_url,n.type_name=e.type_name,n}async parseVodDetailfromJson(e){let n,r=e.list;if(r.length>0){let i=r[0];n=this.parseVodDetail(i)}return n}async setClasses(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of n.class)r.type_pid!==0&&this.classes.push(this.getTypeDic(r.type_name,r.type_id))}async setFilterObj(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of this.classes){let i=r.type_id.toString();if(i!=="\u6700\u8FD1\u66F4\u65B0"){let l={key:"1",name:"\u5206\u7C7B",value:[{n:"\u5168\u90E8",v:i}]};for(let s of n.class){let a=s.type_name;a===this.type_name_18&&(this.type_id_18=s.type_id.toString()),this.remove18?s.type_pid===r.type_id&&a!==this.type_name_18&&l.value.push({n:a,v:s.type_id.toString()}):s.type_pid===r.type_id&&a===this.type_name_18&&l.value.push({n:a,v:s.type_id.toString()})}this.remove18?this.filterObj[i]=[l]:this.classes=[this.getTypeDic("\u6700\u8FD1\u66F4\u65B0","\u6700\u8FD1\u66F4\u65B0"),this.getTypeDic(this.type_name_18,this.type_id_18)]}}}async setHomeVod(){let e=await this.fetch(this.siteUrl+"/index.php/ajax/data",{mid:"1"},this.getHeader());this.homeVodList=await this.parseVodShortListFromJson(JSON.parse(e))}async setDetail(e){let n=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:e},this.getHeader());this.vodDetail=await this.parseVodDetailfromJson(JSON.parse(n))}async setCategory(e,n,r,i){e=i[1]??e;let l=this.siteUrl+`/index.php/ajax/data?mid=1&tid=${e}&page=${n}&limit=20`;await this.jadeLog.debug(`\u5206\u7C7BURL:${l}`);let s=await this.fetch(l,null,this.getHeader());await this.jadeLog.debug(`\u5206\u7C7B\u5185\u5BB9\u4E3A:${s}`),this.vodList=await this.parseVodShortListFromJson(JSON.parse(s))}async setSearch(e,n){let r=await this.fetch(this.siteUrl+"/api.php/provide/vod/",{wd:e},this.getHeader());this.vodList=await this.parseVodShortListFromJson(JSON.parse(r),!0)}async proxy(e,n){await this.jadeLog.debug(`\u6B63\u5728\u8BBE\u7F6E\u53CD\u5411\u4EE3\u7406 segments = ${e.join(",")},headers = ${JSON.stringify(n)}`);let r=e[0],i=vi(e[1]);if(await this.jadeLog.debug(`\u53CD\u5411\u4EE3\u7406\u53C2\u6570\u4E3A:${i}`),r==="detail"){let l=await this.fetch(this.siteUrl+"/api.php/provide/vod",{ac:"detail",ids:i},this.getHeader()),s=await this.parseVodDetailfromJson(JSON.parse(l)),a=await this.fetch(s.vod_pic,null,this.getHeader(),!1,!1,2);return B.isEmpty(a)?JSON.stringify({code:500,buffer:2,content:"",headers:{}}):JSON.stringify({code:200,buffer:2,content:a,headers:{}})}}};var zw=class extends uo{constructor(){super(),this.siteUrl="https://haiwaikan.com",this.remove18=!0,this.type_id_18=0}async spiderInit(e){await super.spiderInit(e)}async init(e){await super.init(e),await this.spiderInit(null)}getAppName(){return"\u6D77\u5916\u770B"}getName(){return"\u2615\u2503\u6D77\u5916\u770B\u2503\u2615\u5899"}getJSName(){return"haiwaikan"}getType(){return 3}async setClasses(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of n.class)r.type_id<26&&this.classes.push(this.getTypeDic(r.type_name,r.type_id.toString()));this.content_json=n}async getFilter(e,n){let r=[],i={key:"1",name:"\u5168\u90E8\u7C7B\u522B",value:[{n:"\u5168\u90E8\u7C7B\u522B",v:e.toString()}]};for(let l of n.class){let s=l.type_id,a=0,o=0;e===20&&(a=50,o=27),e===21&&(a=128,o=100),e===22&&(a=143,o=134),e===23&&(a=135,o=127),s<a&&s>o&&i.value.push({n:l.type_name,v:s.toString()})}return i.value.length>1?(r.push(i),r):null}async setFilterObj(){let e=await this.fetch(this.siteUrl+"/api.php/provide/vod/from",{ac:"list"},this.getHeader()),n=JSON.parse(e);for(let r of this.classes){let i=r.type_id;if(i!=="\u6700\u8FD1\u66F4\u65B0"){let l=await this.getFilter(parseInt(i),n);l!==null&&(this.filterObj[i]=l)}}}},mn=new zw;var Gw=class extends Re{constructor(){super()}getName(){return mn.getName()}getAppName(){return mn.getAppName()}getJSName(){return mn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await mn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await mn.initCookie(e.server.config.bilicookie),await mn.spiderInit(e),mn.cfgObj.code=0,mn.catOpenStatus=!0,mn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await mn.setClasses(),this.classes=mn.classes}async setFilterObj(){await mn.setFilterObj(),this.filterObj=mn.filterObj}async setHomeVod(){await mn.setHomeVod(),this.homeVodList=mn.homeVodList}async setCategory(e,n,r,i){await mn.setCategory(e,n,r,i),this.vodList=mn.vodList}async setDetail(e){await mn.setDetail(e),this.vodDetail=mn.vodDetail}async setPlay(e,n,r){await mn.setPlay(e,n,r),this.playUrl=mn.playUrl,this.result=mn.result}async setSearch(e,n,r){await mn.setSearch(e,n,r),this.vodList=mn.vodList,this.result=mn.result}async setProxy(e,n){return await mn.proxy(e,n)}},co=new Gw;async function _K(t,e){return await co.init(t,e)}async function EK(t,e){return await co.home(t,e)}async function cxe(t,e){return await co.homeVod(t,e)}async function bK(t,e){return await co.category(t,e)}async function wK(t,e){return await co.detail(t,e)}async function SK(t,e){return await co.play(t,e)}async function TK(t,e){return await co.search(t,e)}async function pxe(t,e){return await co.proxy(t,e)}var xK={meta:{key:mn.getJSName(),name:mn.getName(),type:mn.getType()},api:async t=>{t.post("/init",_K),t.post("/home",EK),t.post("/category",bK),t.post("/detail",wK),t.post("/play",SK),t.post("/search",TK),t.get("/proxy/:what/:ids/:end",pxe)},spider:{init:_K,home:EK,homeVod:cxe,category:bK,detail:wK,play:SK,search:TK}};function vf(t,e){let n=_f();return vf=function(r,i){return r=r-424,n[r]},vf(t,e)}function _f(){let t=["1580630GngmmA","117uvwflw","join","current_id","565448Apkhig","23092JwmytW","707152yowhOv","getElementById","855936CGaczt","length","2966831GCGpvn","611266nfcTEf","value","substring"];return _f=function(){return t},_f()}(function(t,e){let n=vf,r=t();for(;;)try{if(-parseInt(n(436))/1+parseInt(n(429))/2+-parseInt(n(433))/3*(-parseInt(n(437))/4)+-parseInt(n(432))/5+parseInt(n(426))/6+parseInt(n(428))/7+parseInt(n(424))/8===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(_f,304089);function fxe(t,e){let n=vf,r=t,i=e;if(!r||!i)return;let l=r.length,s=r[n(431)](l-4,l),a=[];for(let o=0;o<s[n(427)];o++){let u=parseInt(s[o]),c=u%3+1;a[o]=i[n(431)](c,c+8),i=i[n(431)](c+8,i[n(427)])}return a[n(434)]("")}var Jw=class extends Fe{constructor(){super(),this.siteUrl="https://v.ikanbot.com"}getName(){return"\u{1F916}\u2503\u7231\u770B\u673A\u5668\u4EBA\u2503\u{1F916}"}getAppName(){return"\u7231\u770B\u673A\u5668\u4EBA"}getJSName(){return"ikanbot"}getType(){return 3}async spiderInit(e=null){e!==null?this.jsBase=await js2Proxy(e,"img",this.getHeader()):this.jsBase=await js2Proxy(!0,this.siteType,this.siteKey,"img/",this.getHeader())}async init(e){await super.init(e),await this.spiderInit(null)}async parseVodShortListFromDoc(e){let n=[],r=e(e('[class="row list-wp"]')).find("a");for(let i of r){let l=new Ne,s=e(i).find("img")[0];l.vod_id=i.attribs.href,l.vod_pic=this.jsBase+ti(s.attribs["data-src"]),l.vod_name=s.attribs.alt,n.push(l)}return n}getChildren(e,n){try{return e[n].children[0].data}catch{return""}}async parseVodDetailFromDoc(e){let n=e("div.detail > .meta"),r=new Be;r.vod_pic=this.jsBase+ti(e("div.item-root > img")[0].attribs["data-src"]),r.vod_name=this.getChildren(n,0),r.vod_year=this.getChildren(n,1),r.vod_area=this.getChildren(n,3),r.vod_actor=this.getChildren(n,4);let i=Te(/<input type="hidden" id="current_id" value="(.*?)"/,e.html()),l=Te(/<input type="hidden" id="e_token" value="(.*?)"/,e.html()),s=Te(/<input type="hidden" id="mtype" value="(.*?)"/,e.html()),a={videoId:i,mtype:s,token:fxe(i,l)},o=await this.fetch(this.siteUrl+"/api/getResN",a,this.getHeader()),u=JSON.parse(o).data.list,c={},f=0,m=[];for(let d of u){let y=JSON.parse(d.resData);for(let _ of y){f=f+1;let S=_.flag,w=_.url;!S||!w||c[S]||(m.push(`\u7EBF\u8DEF${f}`),c[S]=w)}}return r.vod_play_from=m.join("$$$"),r.vod_play_url=B.values(c).join("$$$"),r}async parseVodShortListFromDocBySearch(e){let n=[],r=e("div.media > div.media-left > a");for(let i of r){let l=new Ne,s=e(i).find("img:first")[0];l.vod_id=i.attribs.href,l.vod_name=s.attribs.alt,l.vod_pic=this.jsBase+ti(s.attribs["data-src"]),n.push(l)}return n}async setClasses(){let e=await this.fetch(this.siteUrl+"/category",null,this.getHeader());if(!B.isEmpty(e)){let n=$e(e),r=n(n(n('[class="row visible-xs-block visible-sm-block"]')).find("li")).find("a");for(let i of r)this.classes.push({type_name:n(i).text(),type_id:i.attribs.href})}}async setFilterObj(){for(let e of this.classes.slice(1,9)){let n=e.type_id;if(n.indexOf("category")===-1||n.indexOf(",")>-1){let r=n.split(",").slice(-1)[0],i=await this.fetch(this.siteUrl+r,null,this.getHeader());if(!B.isEmpty(i)){let l=$e(i),s=l('[class="row visible-xs-block visible-sm-block"]'),a=s.find('[class="nav nav-pills"]').find("a"),o=[];n.indexOf(",")>-1&&o.push({n:"\u5168\u90E8",v:n.split(",")[0]});let u={key:n,name:l(s.find("h5")).text(),value:o};for(let c of a)o.push({n:l(c).text(),v:c.attribs.href});o.length>0&&(this.filterObj[n]=[u])}}}}async setHomeVod(){let e=await this.fetch(this.siteUrl,null,this.getHeader());if(!B.isEmpty(e)){let n=$e(e);this.homeVodList=await this.parseVodShortListFromDoc(n)}}async setCategory(e,n,r,i){let l=this.siteUrl+(i[e]||e.split(",")[0]),s=!1;l.indexOf("html")>-1?l=l.replace(".html",n>1?`-p-${n}.html`:".html"):(l=l+`?p=${n}`,s=!0),await this.jadeLog.debug(`\u5206\u7C7BURL:${l}`);let a=await this.fetch(l,null,this.getHeader());if(!B.isEmpty(a)){let o=$e(a);this.vodList=await this.parseVodShortListFromDoc(o);let u=o("div.page-more > a:contains(\u4E0B\u4E00\u9875)");s&&(this.page=parseInt(u[0].attribs.href.split("p=")[1]));let c=u.length>0;this.limit=24,this.count=c?parseInt(n)+1:parseInt(n),this.total=this.limit*this.count}}async setDetail(e){let n=await this.fetch(this.siteUrl+e,null,this.getHeader());if(!B.isEmpty(n)){let r=$e(n);this.vodDetail=await this.parseVodDetailFromDoc(r)}}async setSearch(e,n){let r=await this.fetch(this.siteUrl+"/search?q="+e,null,this.getHeader());if(!B.isEmpty(r)){let i=$e(r);this.vodList=await this.parseVodShortListFromDocBySearch(i)}}async setPlay(e,n,r){this.playUrl=n}},yn=new Jw;var Kw=class extends Re{constructor(){super()}getName(){return yn.getName()}getAppName(){return yn.getAppName()}getJSName(){return yn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await yn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await yn.initCookie(e.server.config.bilicookie),await yn.spiderInit(e),yn.cfgObj.code=0,yn.catOpenStatus=!0,yn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await yn.setClasses(),this.classes=yn.classes}async setFilterObj(){await yn.setFilterObj(),this.filterObj=yn.filterObj}async setHomeVod(){await yn.setHomeVod(),this.homeVodList=yn.homeVodList}async setCategory(e,n,r,i){await yn.setCategory(e,n,r,i),this.vodList=yn.vodList}async setDetail(e){await yn.setDetail(e),this.vodDetail=yn.vodDetail}async setPlay(e,n,r){await yn.setPlay(e,n,r),this.playUrl=yn.playUrl,this.result=yn.result}async setSearch(e,n,r){await yn.setSearch(e,n,r),this.vodList=yn.vodList,this.result=yn.result}async setProxy(e,n){return await yn.proxy(e,n)}},po=new Kw;async function AK(t,e){return await po.init(t,e)}async function OK(t,e){return await po.home(t,e)}async function dxe(t,e){return await po.homeVod(t,e)}async function NK(t,e){return await po.category(t,e)}async function CK(t,e){return await po.detail(t,e)}async function RK(t,e){return await po.play(t,e)}async function IK(t,e){return await po.search(t,e)}async function hxe(t,e){return await po.proxy(t,e)}var kK={meta:{key:yn.getJSName(),name:yn.getName(),type:yn.getType()},api:async t=>{t.post("/init",AK),t.post("/home",OK),t.post("/category",NK),t.post("/detail",CK),t.post("/play",RK),t.post("/search",IK),t.get("/proxy/:what/:ids/:end",hxe)},spider:{init:AK,home:OK,homeVod:dxe,category:NK,detail:CK,play:RK,search:IK}};var Xw=class extends Fe{constructor(){super(),this.siteUrl="https://ali.gitcafe.ink"}getName(){return"\u{1F98A}\u2503\u963F\u91CC\u7EB8\u6761\u2503\u{1F98A}"}getAppName(){return"\u963F\u91CC\u7EB8\u6761"}getJSName(){return"gitcafe"}getType(){return 3}async getApiUrl(){let e=await this.fetch(this.siteUrl,null,this.getHeader());if(!B.isEmpty(e)){let n=Te(/<script src='(.*?)'><\/script>/,e),r=await this.fetch(n,null,this.getHeader());return{api:"https:"+Te(/ return '(.*?)' \+ /,r)+new Date().getTime(),search_api:Te(/const SEARCH_API = '(.*?)';/,r)}}}async getContentJson(){let e=await this.getApiUrl(),n=await this.fetch(e.api,null,this.getHeader());if(this.search_api=e.search_api,!B.isEmpty(n))return JSON.parse(n)}async spiderInit(){this.content_json=await this.getContentJson(),this.token_dic=await this.load_cache()}async init(e){await this.spiderInit(),await super.init(e),await qi(this.cfgObj.token)}async parseClassFromJson(e){let n=Object.keys(e.data).slice(0,19);for(let r of n)this.classes.push({type_name:e.data[r].name,type_id:r})}async parseVodShortListFromJson(e){let n=[],r=this.getClassIdList();for(let i of e){let l=new Ne;r.includes(i.cat)&&(l.vod_id=JSON.stringify(i),l.vod_name=i.title,l.vod_remarks=i.date,n.push(l))}return n}async parseVodDetailfromJson(e){let n=this.getClassNameList(),r=this.getClassIdList(),i=new Be;i.vod_name=e.title,i.vod_remarks=e.creatime??e.date,i.type_name=n[r.indexOf(e.cat)],i.vod_content=e.des;let l="https://www.aliyundrive.com/s/"+e.alikey,s=await Tl([l]);return i.vod_play_url=s.vod_play_url,i.vod_play_from=s.vod_play_from,i}async setClasses(){await this.parseClassFromJson(this.content_json)}async setHomeVod(){this.homeVodList=await this.parseVodShortListFromJson(this.content_json.info.new)}async setDetail(e){let n=JSON.parse(e);this.vodDetail=await this.parseVodDetailfromJson(n)}async setCategory(e,n,r,i){this.vodList=await this.parseVodShortListFromJson(this.content_json.data[e].catdata)}async setSearch(e,n){await this.refreshToken();let r={action:"search",from:"web",token:this.token_dic.token,keyword:e},i=await this.post(this.search_api,r,this.getHeader());if(!B.isEmpty(i)){let l=JSON.parse(i);this.vodList=await this.parseVodShortListFromJson(l.data)}}async refreshToken(){let e=new Date().getTime();B.isEmpty(this.token_dic.token)?(await this.get_token(),await this.jadeLog.debug("Token\u4E3A\u7A7A,\u5237\u65B0Token")):e-parseInt(this.token_dic.date)>24*60*60*1e3?(await this.jadeLog.debug(`Token\u5230\u671F,\u4E0A\u6B21\u83B7\u53D6Token\u65F6\u95F4\u4E3A:${e},\u5F53\u524D\u65F6\u95F4\u4E3A:${parseInt(this.token_dic.date)},\u5237\u65B0Token`),await this.get_token()):await this.jadeLog.debug("Token\u4ECD\u7136\u6709\u6548,\u65E0\u9700\u5237\u65B0",!0)}async get_token(){try{let e={action:"get_token",from:"web"},n=await this.post(this.search_api,e,this.getHeader());if(!B.isEmpty(n)){let r=JSON.parse(n),i=new Date().getTime();this.token_dic.token=r.data,this.token_dic.date=i.toString(),await this.write_cache()}}catch(e){await this.jadeLog.error("\u83B7\u53D6Token\u5931\u8D25,\u5931\u8D25\u539F\u56E0\u4E3A:"+e)}}async write_cache(){await local.set("gitcafe_token","token",JSON.stringify(this.token_dic))}async load_cache(){try{let e=await local.get("gitcafe_token","token");return JSON.parse(e)}catch{return{token:"",date:""}}}async play(e,n,r){return await xl(e,n,r)}},gn=new Xw;var Ww=class extends Re{constructor(){super()}getName(){return gn.getName()}getAppName(){return gn.getAppName()}getJSName(){return gn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await gn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await gn.initCookie(e.server.config.bilicookie),await gn.spiderInit(e),gn.cfgObj.code=0,gn.catOpenStatus=!0,gn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await gn.setClasses(),this.classes=gn.classes}async setFilterObj(){await gn.setFilterObj(),this.filterObj=gn.filterObj}async setHomeVod(){await gn.setHomeVod(),this.homeVodList=gn.homeVodList}async setCategory(e,n,r,i){await gn.setCategory(e,n,r,i),this.vodList=gn.vodList}async setDetail(e){await gn.setDetail(e),this.vodDetail=gn.vodDetail}async setPlay(e,n,r){await gn.setPlay(e,n,r),this.playUrl=gn.playUrl,this.result=gn.result}async setSearch(e,n,r){await gn.setSearch(e,n,r),this.vodList=gn.vodList,this.result=gn.result}async setProxy(e,n){return await gn.proxy(e,n)}},fo=new Ww;async function DK(t,e){return await fo.init(t,e)}async function PK(t,e){return await fo.home(t,e)}async function mxe(t,e){return await fo.homeVod(t,e)}async function LK(t,e){return await fo.category(t,e)}async function FK(t,e){return await fo.detail(t,e)}async function jK(t,e){return await fo.play(t,e)}async function UK(t,e){return await fo.search(t,e)}async function yxe(t,e){return await fo.proxy(t,e)}var MK={meta:{key:gn.getJSName(),name:gn.getName(),type:gn.getType()},api:async t=>{t.post("/init",DK),t.post("/home",PK),t.post("/category",LK),t.post("/detail",FK),t.post("/play",jK),t.post("/search",UK),t.get("/proxy/:what/:ids/:end",yxe)},spider:{init:DK,home:PK,homeVod:mxe,category:LK,detail:FK,play:jK,search:UK}};var z5=class extends Fe{constructor(){super(),this.siteUrl="http://op.ysdqjs.cn",this.cookie="",this.extendObj={extend:"\u7C7B\u578B",area:"\u5730\u533A",lang:"\u8BED\u8A00",year:"\u5E74\u4EE3"},this.parseMap={}}async request(e,n,r){let i={"User-Agent":zr};B.isEmpty(this.cookie)||(i.Cookie=this.cookie);let l=n==="post"?"form-data":"",s=await req(e,{method:n||"get",headers:i,data:r,postType:l});if(s.code===403){let a=s.data.match(/window\.location\.href ="(.*?)"/)[1];this.cookie=B.isArray(s.headers["set-cookie"])?s.headers["set-cookie"].join(";"):s.headers["set-cookie"],i.Cookie=this.cookie,s=await req(this.siteUrl+a,{method:n||"get",headers:i,data:r,postType:l})}return s.content}async postData(e,n){let r=Math.floor(new Date().getTime()/1e3),s={sign:md5X("kj5649ertj84ks89r4jh8s45hf84hjfds04k"+r).toString(),timestamp:r},a=n?B.merge(s,n):s;return await this.request(e,"post",a)}getName(){return"\u26C4\u2503\u5929\u5929\u5F71\u89C6\u2503\u26C4"}getAppName(){return"\u5929\u5929\u5F71\u89C6"}getJSName(){return"tiantian"}getType(){return 3}async init(e){await super.init(e),this.danmuStaus=!1}generateParam(e,n,r,i){let l={type_id:e,page:n,limit:i};return r.extend!==void 0&&r.extend!=="\u5168\u90E8"&&(l.class=r.extend),r.area!==void 0&&r.area!=="\u5168\u90E8"&&(l.area=r.area),r.lang!==void 0&&r.lang!=="\u5168\u90E8"&&(l.lang=r.lang),r.year!==void 0&&r.year!=="\u5168\u90E8"&&(l.year=r.year),l}async getFilter(e){let n=[];return Object.keys(e).forEach(r=>{if(Array.isArray(e[r])){let i={key:r,name:this.extendObj[r],value:[]},l=!1;for(let s of e[r])r==="year"&&!e[r].includes("2024")&&s!=="\u5168\u90E8"&&!l&&(i.value.push({n:"2024",v:"2024"}),l=!0),B.isEmpty(s)||i.value.push({n:s,v:s});i.value.length>1&&n.push(i)}}),n}async setClasses(){let e=JSON.parse(await this.postData(this.siteUrl+"/v2/type/top_type"));for(let n of e.data.list){let r=n.type_name,i=n.type_id.toString();this.classes.push(this.getTypeDic(r,i)),this.filterObj[i]=await this.getFilter(n)}}async parseVodShortListFromJson(e){let n=[];for(let r of e){let i=new Ne;i.load_data(r),B.isEmpty(i.vod_pic)&&r.vod_pic_thumb!==void 0&&(i.vod_pic=r.vod_pic_thumb),i.vod_name!=="\u9996\u9875\u8F6E\u64AD"&&n.push(i)}return n}async parseVodDetailfromJson(e){let n=new Be;n.load_data(e),n.vod_content=Ep(n.vod_content);let r=e.vod_play_list,i={};return B.each(r,l=>{let s=l.name,a="",o=l.urls,u=l.parse_urls;B.isEmpty(u)||(this.parseMap[s]=u);let c=B.map(o,f=>{let m=f.name,d=f.url;return m+"$"+d});B.isEmpty(c)||(a=c.join("#"),i[s]=a)}),n.vod_play_from=B.keys(i).join("$$$"),n.vod_play_url=B.values(i).join("$$$"),n}async setHomeVod(){let e=JSON.parse(await this.postData(this.siteUrl+"/v2/type/tj_vod")),n=[];for(let r of e.data.type_vod)r.type_name!=="\u5E7F\u544A"&&(n=await this.parseVodShortListFromJson(r.vod),this.homeVodList=[...this.homeVodList,...n]);n=await this.parseVodShortListFromJson(e.data.loop),this.homeVodList=[...this.homeVodList,...n],n=await this.parseVodShortListFromJson(e.data.cai),this.homeVodList=[...this.homeVodList,...n]}async setCategory(e,n,r,i){let s=this.generateParam(e,n,i,12),a=JSON.parse(await this.postData(this.siteUrl+"/v2/home/type_search",s));this.vodList=await this.parseVodShortListFromJson(a.data.list)}async setDetail(e){let n={vod_id:e},r=JSON.parse(await this.postData(this.siteUrl+"/v2/home/vod_details",n));this.vodDetail=await this.parseVodDetailfromJson(r.data)}async setPlay(e,n,r){let i=this.parseMap[e];if((e.indexOf("\u8292\u679C")>-1||e.indexOf("\u817E\u8BAF")>-1||e.indexOf("\u7231\u5947\u827A")>-1)&&(this.danmuStaus=!0,this.catOpenStatus||(this.danmuUrl=await this.danmuSpider.downloadDanmu("https://dmku.thefilehosting.com/?ac=dm&url="+n))),!B.isEmpty(i)){for(let l of i)if(!B.isEmpty(l))try{let s=await this.request(l+n),a=JSON.parse(s);if(!B.isEmpty(a.url)){this.playUrl=a.url;break}}catch{}}}async setSearch(e,n,r){let l={keyword:e,page:r,limit:12},s=JSON.parse(await this.postData(this.siteUrl+"/v2/home/search",l));this.vodList=await this.parseVodShortListFromJson(s.data.list);let a=parseInt(r),o=a;this.vodList.length===12&&(o=a+1),this.result.setPage(a,o,12,o)}},vn=new z5;var Yw=class extends Re{constructor(){super()}getName(){return vn.getName()}getAppName(){return vn.getAppName()}getJSName(){return vn.getJSName()}async init(e,n){dataBase=e.server.db,this.getAppName().indexOf("\u963F\u91CC")>-1||this.getAppName()==="push_agent"?await vn.initAli(e.server.config.alitoken):this.getAppName()==="\u54D4\u54E9\u54D4\u54E9"&&await vn.initCookie(e.server.config.bilicookie),await vn.spiderInit(e),vn.cfgObj.code=0,vn.catOpenStatus=!0,vn.classes.push({type_name:"\u6700\u8FD1\u66F4\u65B0",type_id:"\u6700\u8FD1\u66F4\u65B0"}),await super.init(e,n)}async setClasses(){await vn.setClasses(),this.classes=vn.classes}async setFilterObj(){await vn.setFilterObj(),this.filterObj=vn.filterObj}async setHomeVod(){await vn.setHomeVod(),this.homeVodList=vn.homeVodList}async setCategory(e,n,r,i){await vn.setCategory(e,n,r,i),this.vodList=vn.vodList}async setDetail(e){await vn.setDetail(e),this.vodDetail=vn.vodDetail}async setPlay(e,n,r){await vn.setPlay(e,n,r),this.playUrl=vn.playUrl,this.result=vn.result}async setSearch(e,n,r){await vn.setSearch(e,n,r),this.vodList=vn.vodList,this.result=vn.result}async setProxy(e,n){return await vn.proxy(e,n)}},ho=new Yw;async function $K(t,e){return await ho.init(t,e)}async function BK(t,e){return await ho.home(t,e)}async function gxe(t,e){return await ho.homeVod(t,e)}async function HK(t,e){return await ho.category(t,e)}async function VK(t,e){return await ho.detail(t,e)}async function qK(t,e){return await ho.play(t,e)}async function zK(t,e){return await ho.search(t,e)}async function vxe(t,e){return await ho.proxy(t,e)}var GK={meta:{key:vn.getJSName(),name:vn.getName(),type:vn.getType()},api:async t=>{t.post("/init",$K),t.post("/home",BK),t.post("/category",HK),t.post("/detail",VK),t.post("/play",qK),t.post("/search",zK),t.get("/proxy/:what/:ids/:end",vxe)},spider:{init:$K,home:BK,homeVod:gxe,category:HK,detail:VK,play:qK,search:zK}};var Qw="abacdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789";function Ef(t,e){let n="",r=e===void 0?!0:e;for(let i=0;i<t;i++){let l=B.random(0,r?Qw.length-1:Qw.length-11);n+=Qw[l]}return n}function _xe(){return{brand:"Huawei",model:"HUAWEI Mate 20",release:"10",buildId:Ef(3,!1).toUpperCase()+B.random(11,99)+Ef(1,!1).toUpperCase()}}function Exe(t,e){return e.trim().replaceAll(t,"").replace(/<|>|《|》/g,"").replace(/\$|#/g," ").trim()}function JK(t,e){try{let n=e.url??"";if(n.startsWith("//")&&(n="https:"+n),!n.startsWith("http"))return{};let r=e.headers||{},i=(e["user-agent"]||"").trim();i.length>0&&(r["User-Agent"]=i);let l=(e.referer||"").trim();return l.length>0&&(r.Referer=l),B.keys(r).forEach(s=>{r[s]||delete r[s]}),{header:r,url:n}}catch{}return{}}var Zw=class extends Fe{constructor(){super(),this.siteUrl="https://api1.baibaipei.com:8899",this.device={},this.parse=[]}getName(){return"\u{1F6E5}\uFE0E\u2503\u5FEB\u770B\u89C6\u9891\u2503\u{1F6E5}\uFE0E"}getAppName(){return"\u5FEB\u770B\u89C6\u9891"}getJSName(){return"kuaikan"}getType(){return 3}async init(e){await super.init(e),this.danmuStaus=!0,await this.setDevice()}async request(e,n,r,i){let l=DV().valueOf().toString(),s=Ef(32),a=Ve.enc.Hex.stringify(Ve.MD5("H58d2%gLbeingX*%D4Y8!C!!@G_"+l+"_"+s)).toString().toLowerCase(),o={"user-agent":r||this.device.ua};e.includes("baibaipei")&&(o["device-id"]=this.device.id,o.sign=a,o.time=l,o.md5=s,o.version="2.1.5",o["system-model"]=this.device.model,o["system-brand"]=this.device.brand,o["system-version"]=this.device.release,o.host="api1.baibaipei.com:8899"),i||(o["Content-Type"]="application/x-www-form-urlencoded");let u=await req(e,{method:i?"get":"post",headers:o,data:n||{},postType:"form"});await this.jadeLog.debug(`URL:${e},headers:${JSON.stringify(o)},data:${[JSON.stringify(n)]}`);let c=u.content;try{let f=Ve.enc.Utf8.parse("IjhHsCB2B5^#%0Ag"),m=Ve.enc.Utf8.parse("y8_m.3rauW/>j,}."),d=Ve.enc.Base64.parse(c),y=Ve.AES.decrypt({ciphertext:d},f,{iv:m,padding:Ve.pad.Pkcs7});return y=Ve.enc.Utf8.stringify(y),await this.jadeLog.debug(`response:${y}`),JSON.parse(y)}catch{return JSON.parse(c)}}async setDevice(){let e="device",n=await local.get(this.siteKey,e);if(n.length>0)try{this.device=JSON.parse(n)}catch{}B.isEmpty(this.device)&&(this.device=_xe(),this.device.id=Ef(13).toLowerCase(),this.device.ua="okhttp/3.14.9",await local.set(this.siteKey,e,JSON.stringify(this.device)))}async setClasses(){await this.setDevice();let e=await this.request(this.siteUrl+"/api.php/Index/getTopVideoCategory");for(let n of e.data){let r=n.nav_name;if(r==="\u63A8\u8350")continue;let i=n.nav_type_id.toString();this.classes.push({type_id:i,type_name:r})}}async getFilter(e){await this.jadeLog.debug(JSON.stringify(e));let n=[];for(let r of Object.keys(e)){let i=e[r];r==="plot"&&(r="class");let l="";switch(r){case"class":l="\u7C7B\u578B";break;case"area":l="\u5730\u533A";break;case"lang":l="\u8BED\u8A00";break;case"year":l="\u5E74\u4EE3";break;case"sort":l="\u6392\u5E8F";break}if(l.length===0)continue;let s={key:r,name:l},a=[];for(let o=0;o<i.length;o++){let u=i[o],c=r==="sort"?o+"":u==="\u5168\u90E8"?"0":u;a.push({n:u,v:c})}s.init=r==="sort"?"1":a[0].v,s.value=a,n.push(s)}return n}async setFilterObj(){for(let e of this.classes){let n=e.type_id;if(n!=="\u6700\u8FD1\u66F4\u65B0"){let r=await this.request(this.siteUrl+"/api.php/Video/getFilterType",{type:n});this.filterObj[n]=await this.getFilter(r.data)}}}async parseVodShortListFromJSONByHome(e){let n=[];for(let r of e.video){let i=await this.parseVodShortListFromJson(r.list);n.push(...i)}return n}async parseVodShortListFromJson(e){let n=[];for(let r of e){let i=new Ne;i.vod_id=r.vod_id,i.vod_name=r.vod_name,i.vod_pic=r.vod_pic,i.vod_remarks=r.vod_remarks,n.push(i)}return n}async parseVodDetailfromJson(e){let n=new Be;n.load_dic(JSON.stringify(e)),n.vod_content=e.vod_content.trim(),n.type_name=e.vod_class;let r={};for(let s of e.vod_play){let a=s.playerForm;if(a==="jp"&&this.catOpenStatus||a==="xg"&&this.catOpenStatus)continue;let o=[];for(let u of s.url)o.push(Exe(n.vod_name,u.title)+"$"+u.play_url);!r.hasOwnProperty(a)&&o.length>0&&(r[a]=o)}this.parse=e.parse||[],n.vod_play_from=B.keys(r).join("$$$");let i=B.values(r),l=[];for(let s of i)l.push(s.join("#"));return n.vod_play_url=l.join("$$$"),n}async setHomeVod(){let e=await this.request(this.siteUrl+"/api.php/Index/getHomePage",{p:"1",type:"1"});this.homeVodList=await this.parseVodShortListFromJSONByHome(e.data)}async setCategory(e,n,r,i){n===0&&(n=1);let l=this.siteUrl+"/api.php/Video/getFilterVideoList",s=JSON.parse(iu(`{
"type": "{{tid}}",
"p": "{{pg}}",
"area": "{{ext.area|default(0)}}",
+1 -1
View File
@@ -1 +1 @@
6d76c79173d3e4328fc87a0d9d0001d3
3fafbf5c659be0299f3d22455362a9db
+17 -13
View File
@@ -1,4 +1,4 @@
import {__jsEvalReturn} from './liujiushu.js';
import {__jsEvalReturn} from './tiantian.js';
import * as Utils from "../lib/utils.js";
@@ -50,20 +50,33 @@ async function testMusicPlay(vodDetail) {
}
async function test() {
let siteKey = 'liujiushu';
let siteKey = 'tiantian';
let siteType = 0;
await spider.init({
skey: siteKey, stype: siteType, ext: {
"token": "6827db23e5474d02a07fd7431d3d5a5a",
"box": "TV",
"code": "1",
"from": "liujiushu",
"from": "tiantian",
"danmu": true,
"cookie": "buvid3=02675249-8ED3-C418-87F5-59E18316459714816infoc; b_nut=1704421014; _uuid=5D435F74-F574-D9AB-62C1-B9294DE465D913102infoc; buvid_fp=e8c5650c749398e9b5cad3f3ddb5081e; buvid4=007E85D1-52C1-7E6E-07CF-837FFBC9349516677-024010502-J5vTDSZDCw4fNnXRejbSVg%3D%3D; rpdid=|()kYJmulRu0J'u~|RRJl)JR; PVID=1; SESSDATA=3be091d3%2C1720332009%2C699ed%2A11CjAcCdwXG5kY1umhCOpQHOn_WP7L9xFBfWO7KKd4BPweodpR6VyIfeNyPiRmkr5jCqsSVjg0R0dZOVVHRUo3RnhPRTZFc3JPbGdiUjFCdHpiRDhiTkticmdKTjVyS1VhbDdvNjFMSDJlbUJydUlRdjFUNGFBNkJlV2ZTa0N1Q1BEVi1QYTQzTUh3IIEC; bili_jct=b0ee7b5d3f27df893545d811d95506d4; DedeUserID=78014638; DedeUserID__ckMd5=4c8c5d65065e468a; enable_web_push=DISABLE; header_theme_version=CLOSE; home_feed_column=5; CURRENT_BLACKGAP=0; CURRENT_FNVAL=4048; b_lsid=75E916AA_18EA1A8D995; bsource=search_baidu; FEED_LIVE_VERSION=V_HEADER_LIVE_NO_POP; browser_resolution=1507-691; bili_ticket=eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTIzNjk5MTMsImlhdCI6MTcxMjExMDY1MywicGx0IjotMX0.8zQW_fNTCSBlK_JkHnzu3gDw62wuTK1qgKcbGec3swM; bili_ticket_expires=171236985"
}
});
// 测试搜索
let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes))
//测试首页列表
let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod));
//测试分类
let catePage = JSON.parse(await spider.category("1", "2", undefined, {"extend":"动作"}));
console.debug(JSON.stringify(catePage));
// 测试搜索
let search_page = JSON.parse(await spider.search("万相之王",false,1))
console.debug(JSON.stringify(search_page))
@@ -72,16 +85,7 @@ async function test() {
let play = JSON.parse(await spider.play("全卷","闻萱-/diyi/2449/43822990.html"))
await testPlay(detail1)
let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes))
//测试首页列表
let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod));
//测试分类
let catePage = JSON.parse(await spider.category("/sort/2", "2", undefined, {}));
console.debug(JSON.stringify(catePage));
+25 -16
View File
@@ -81,21 +81,18 @@ class TianTianSpider extends Spider {
const param = {
type_id: tid, page: pg, limit: limit,
};
if (extend.class) {
param.class = extend.class;
if (extend["extend"] !== undefined && extend["extend"] !== "全部") {
param.class = extend["extend"];
}
if (extend.area) {
if (extend["area"] !== undefined && extend["area"] !== "全部") {
param.area = extend.area;
}
if (extend.lang) {
if (extend["lang"] !== undefined && extend["lang"] !== "全部") {
param.lang = extend.lang;
}
if (extend.year) {
if (extend["year"] !== undefined && extend["year"] !== "全部") {
param.year = extend.year;
}
// if (extend.order) {
// param.order = extend.order;
// }
return param;
}
@@ -104,10 +101,22 @@ class TianTianSpider extends Spider {
Object.keys(data).forEach(key => {
if (Array.isArray(data[key])) {
let extend_dic = {"key": key, "name": this.extendObj[key], "value": []}
let add_year_status = false
for (const extend_data of data[key]) {
extend_dic["value"].push({"n": extend_data, "v": extend_data})
if (key === "year") {
if (!data[key].includes("2024") && extend_data !== "全部" && !add_year_status) {
extend_dic["value"].push({"n": "2024", "v": "2024"})
add_year_status = true
}
}
if (!_.isEmpty(extend_data)) {
extend_dic["value"].push({"n": extend_data, "v": extend_data})
}
}
if (extend_dic["value"].length > 1) {
extend_list.push(extend_dic)
}
extend_list.push(extend_dic)
}
})
return extend_list
@@ -128,10 +137,10 @@ class TianTianSpider extends Spider {
for (const vodData of vodList) {
let vodShort = new VodShort()
vodShort.load_data(vodData)
if (_.isEmpty(vodShort.vod_pic) && vodData["vod_pic_thumb"] !== undefined){
if (_.isEmpty(vodShort.vod_pic) && vodData["vod_pic_thumb"] !== undefined) {
vodShort.vod_pic = vodData["vod_pic_thumb"]
}
if (vodShort.vod_name !== "首页轮播"){
if (vodShort.vod_name !== "首页轮播") {
vod_list.push(vodShort)
}
@@ -172,15 +181,15 @@ class TianTianSpider extends Spider {
for (const data of resJson["data"]["type_vod"]) {
if (data["type_name"] !== "广告") {
vod_list = await this.parseVodShortListFromJson(data["vod"])
this.homeVodList = [...this.homeVodList,...vod_list]
vod_list = await this.parseVodShortListFromJson(data["vod"])
this.homeVodList = [...this.homeVodList, ...vod_list]
}
}
vod_list = await this.parseVodShortListFromJson(resJson["data"]["loop"])
this.homeVodList = [...this.homeVodList,...vod_list]
this.homeVodList = [...this.homeVodList, ...vod_list]
vod_list = await this.parseVodShortListFromJson(resJson["data"]["cai"])
this.homeVodList = [...this.homeVodList,...vod_list]
this.homeVodList = [...this.homeVodList, ...vod_list]
}
async setCategory(tid, pg, filter, extend) {