mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
1 line
4.0 KiB
JavaScript
1 line
4.0 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 r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,r,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of __getOwnPropNames(t))__hasOwnProp.call(e,o)||o===r||__defProp(e,o,{get:()=>t[o],enumerable:!(l=__getOwnPropDesc(t,o))||l.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),__async=(e,t,r)=>new Promise((l,o)=>{var n=e=>{try{a(r.next(e))}catch(e){o(e)}},s=e=>{try{a(r.throw(e))}catch(e){o(e)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(n,s);a((r=r.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,r,l,o){return __async(this,null,function*(){var n,s,a,i,c,u;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 d=e.split("/").slice(0,3).join("/"),p=[],_=(yield r(`${e}`,{headers:o,signal:t})).data,h=l.load(_),v=_.match(/var\s+url\s*=\s*'([^']+)';/)||[];let m=hubcloudDecode(null==(s=null==(n=v[1])?void 0:n.split("r="))?void 0:s[1])||v[1]||h(".fa-file-download.fa-lg").parent().attr("href")||e;(null==m?void 0:m.startsWith("/"))&&(m=`${d}${m}`);const f=yield fetch(m,{headers:o,signal:t,redirect:"follow"}),y=l.load(yield f.text()),g=y(".btn-success.btn-lg.h6,.btn-danger,.btn-secondary");for(const e of g){let r=y(e).attr("href")||"";switch(!0){case null==r?void 0:r.includes("pixeld"):if(!(null==r?void 0:r.includes("api"))){const e=r.split("/").pop(),t=r.split("/").slice(0,-2).join("/");r=`${t}/api/file/${e}?download`}p.push({server:"Pixeldrain",link:r,type:"mkv"});break;case(null==r?void 0:r.includes(".dev"))&&!(null==r?void 0:r.includes("/?id=")):p.push({server:"Cf Worker",link:r,type:"mkv"});break;case(null==r?void 0:r.includes("hubcloud"))||(null==r?void 0:r.includes("/?id=")):try{const e=yield fetch(r,{method:"HEAD",headers:o,signal:t,redirect:"manual"});let l=r;if(l=e.status>=300&&e.status<400?e.headers.get("location")||r:e.url&&e.url!==r?e.url:e.headers.get("location")||r,l.includes("googleusercontent"))l=l.split("?link=")[1];else{const e=yield fetch(l,{method:"HEAD",headers:o,signal:t,redirect:"manual"});l=e.status>=300&&e.status<400?(null==(a=e.headers.get("location"))?void 0:a.split("?link=")[1])||l:e.url&&e.url!==l?e.url.split("?link=")[1]||e.url:(null==(i=e.headers.get("location"))?void 0:i.split("?link=")[1])||l}p.push({server:"hubcloud",link:l,type:"mkv"})}catch(e){}break;case null==r?void 0:r.includes("cloudflarestorage"):p.push({server:"CfStorage",link:r,type:"mkv"});break;case(null==r?void 0:r.includes("fastdl"))||(null==r?void 0:r.includes("fsl.")):p.push({server:"FastDl",link:r,type:"mkv"});break;case r.includes("hubcdn")&&!r.includes("/?id="):p.push({server:"HubCdn",link:r,type:"mkv"});break;default:if((null==r?void 0:r.includes(".mkv"))||(null==r?void 0:r.includes("?token="))){const e=(null==(u=null==(c=r.match(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/i))?void 0:c[1])?void 0:u.replace(/\./g," "))||"Unknown";p.push({server:e,link:r,type:"mkv"})}}}return p}catch(e){return[]}})}function getStream(e){return __async(this,arguments,function*({link:e,type:t,signal:r,providerContext:l}){const{axios:o,cheerio:n,commonHeaders:s}=l;try{return yield hubcloudExtractor(e,r,o,n,s)}catch(e){return e.message.includes("Aborted"),[]}})}__name(hubcloudExtractor,"hubcloudExtractor"),__name(getStream,"getStream"),exports.getStream=getStream; |