mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
1 line
6.3 KiB
JavaScript
1 line
6.3 KiB
JavaScript
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),__export=(e,t)=>{for(var l in t)__defProp(e,l,{get:t[l],enumerable:!0})},__copyProps=(e,t,l,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of __getOwnPropNames(t))__hasOwnProp.call(e,o)||o===l||__defProp(e,o,{get:()=>t[o],enumerable:!(r=__getOwnPropDesc(t,o))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,l)=>new Promise((r,o)=>{var n=e=>{try{s(l.next(e))}catch(e){o(e)}},a=e=>{try{s(l.throw(e))}catch(e){o(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,a);s((l=l.apply(e,t)).next())}),stream_exports={};__export(stream_exports,{getStream:()=>getStream});var hubcloudDecode=__name(function(e){return void 0===e?"":atob(e.toString())},"hubcloudDecode");function hubcloudExtractor(e,t,l,r,o){return __async(this,null,function*(){var n,a,s,i,d,c;try{o.Cookie="ext_name=ojplmecpdpgccookcobabopnaifgidhf; xla=s4t; cf_clearance=woQrFGXtLfmEMBEiGUsVHrUBMT8s3cmguIzmMjmvpkg-1770053679-1.2.1.1-xBrQdciOJsweUF6F2T_OtH6jmyanN_TduQ0yslc_XqjU6RcHSxI7.YOKv6ry7oYo64868HYoULnVyww536H2eVI3R2e4wKzsky6abjPdfQPxqpUaXjxfJ02o6jl3_Vkwr4uiaU7Wy596Vdst3y78HXvVmKdIohhtPvp.vZ9_L7wvWdce0GRixjh_6JiqWmWMws46hwEt3hboaS1e1e4EoWCvj5b0M_jVwvSxBOAW5emFzvT3QrnRh4nyYmKDERnY";const u=e.split("/").slice(0,3).join("/"),h=[],p=(yield l(`${e}`,{headers:o,signal:t})).data,v=r.load(p),f=p.match(/var\s+url\s*=\s*'([^']+)';/)||[];let y=hubcloudDecode(null==(a=null==(n=f[1])?void 0:n.split("r="))?void 0:a[1])||f[1]||v(".fa-file-download.fa-lg").parent().attr("href")||e;(null==y?void 0:y.startsWith("/"))&&(y=`${u}${y}`);const m=yield fetch(y,{headers:o,signal:t,redirect:"follow"}),_=r.load(yield m.text()),b=_(".btn-success.btn-lg.h6,.btn-danger,.btn-secondary");for(const e of b){let l=_(e).attr("href")||"";switch(!0){case null==l?void 0:l.includes("pixeld"):if(!(null==l?void 0:l.includes("api"))){const e=l.split("/").pop(),t=l.split("/").slice(0,-2).join("/");l=`${t}/api/file/${e}?download`}h.push({server:"Pixeldrain",link:l,type:"mkv"});break;case(null==l?void 0:l.includes(".dev"))&&!(null==l?void 0:l.includes("/?id=")):h.push({server:"Cf Worker",link:l,type:"mkv"});break;case(null==l?void 0:l.includes("hubcloud"))||(null==l?void 0:l.includes("/?id=")):try{const e=yield fetch(l,{method:"HEAD",headers:o,signal:t,redirect:"manual"});let r=l;if(r=e.status>=300&&e.status<400?e.headers.get("location")||l:e.url&&e.url!==l?e.url:e.headers.get("location")||l,r.includes("googleusercontent"))r=r.split("?link=")[1];else{const e=yield fetch(r,{method:"HEAD",headers:o,signal:t,redirect:"manual"});r=e.status>=300&&e.status<400?(null==(s=e.headers.get("location"))?void 0:s.split("?link=")[1])||r:e.url&&e.url!==r?e.url.split("?link=")[1]||e.url:(null==(i=e.headers.get("location"))?void 0:i.split("?link=")[1])||r}h.push({server:"hubcloud",link:r,type:"mkv"})}catch(e){}break;case null==l?void 0:l.includes("cloudflarestorage"):h.push({server:"CfStorage",link:l,type:"mkv"});break;case(null==l?void 0:l.includes("fastdl"))||(null==l?void 0:l.includes("fsl.")):h.push({server:"FastDl",link:l,type:"mkv"});break;case l.includes("hubcdn")&&!l.includes("/?id="):h.push({server:"HubCdn",link:l,type:"mkv"});break;default:if((null==l?void 0:l.includes(".mkv"))||(null==l?void 0:l.includes("?token="))){const e=(null==(c=null==(d=l.match(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/i))?void 0:d[1])?void 0:c.replace(/\./g," "))||"Unknown";h.push({server:e,link:l,type:"mkv"})}}}return h}catch(e){return[]}})}function gdflixExtractor(e,t,l,r,o){return __async(this,null,function*(){var n,a,s,i,d,c,u;try{const h=[],p=(yield l(`${e}`,{headers:o,signal:t})).data;let v=r.load(p);if(null==(n=v("body").attr("onload"))?void 0:n.includes("location.replace")){const e=null==(i=null==(s=null==(a=v("body").attr("onload"))?void 0:a.split("location.replace('"))?void 0:s[1].split("'"))?void 0:i[0];if(e){const n=yield l.get(e,{headers:o,signal:t});v=r.load(n.data)}}try{const t=e.split("/").slice(0,3).join("/"),n=v(".btn-secondary").attr("href")||"";if(n.includes("indexbot")){const e=yield l.get(n,{headers:o}),t=e.data.match(/formData\.append\('token', '([a-f0-9]+)'\)/)[1],r=new FormData;r.append("token",t);const a=e.data.match(/fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/)[1],s=n.split("/download")[0],i=yield fetch(s+"/download?id="+a,{method:"POST",body:r,headers:{Referer:n,Cookie:"PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308"}}),d=yield i.json();h.push({server:"ResumeBot",link:d.url,type:"mkv"})}else{const e=t+n,a=(yield l.get(e,{headers:o})).data,s=r.load(a)(".btn-success").attr("href");s&&h.push({server:"ResumeCloud",link:s,type:"mkv"})}}catch(e){}try{const e=v(".btn-danger").attr("href")||"";if(e.includes("?url=")){const t=e.split("=")[1],l=new FormData;l.append("keys",t);const r=e.split("/").slice(0,3).join("/")+"/api",o=yield fetch(r,{method:"POST",body:l,headers:{"x-token":r}}),n=yield o.json();if(!1===n.error){const e=n.url;h.push({server:"Gdrive-Instant",link:e,type:"mkv"})}}else{const r=(null==(u=null==(c=null==(d=(yield l.head(e,{headers:o,signal:t})).request)?void 0:d.responseURL)?void 0:c.split("?url="))?void 0:u[1])||e;h.push({server:"G-Drive",link:r,type:"mkv"})}}catch(e){}return h}catch(e){return[]}})}__name(hubcloudExtractor,"hubcloudExtractor"),__name(gdflixExtractor,"gdflixExtractor");var getStream=__name(function(e){return __async(this,arguments,function*({link:e,type:t,signal:l,providerContext:r}){var o,n;const{axios:a,cheerio:s,commonHeaders:i}=r;try{if("movie"===t){const t=(yield a.get(e,{headers:i})).data;e=s.load(t)('a:contains("HubCloud")').attr("href")||e}let r="";try{const t=yield a.get(e,{headers:i});r=null==(o=t.data.match(/<meta\s+http-equiv="refresh"\s+content="[^"]*?;\s*url=([^"]+)"\s*\/?>/i))?void 0:o[1],e.includes("/archives/")&&(r=null==(n=t.data.match(/<a\s+[^>]*href="(https:\/\/hubcloud\.[^\/]+\/[^"]+)"/i))?void 0:n[1])}catch(e){}if(!r){if(e.includes("hubcloud"))return yield hubcloudExtractor(e,l,a,s,i);if(e.includes("gdflix"))return yield gdflixExtractor(e,l,a,s,i)}const d=(yield a.get(r,{headers:i})).data,c=s.load(d)(".fa-file-download").parent().attr("href");return yield hubcloudExtractor((null==c?void 0:c.includes("https://hubcloud"))?c:r,l,a,s,i)}catch(e){return[]}})},"getStream");exports.getStream=getStream; |