mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
1 line
5.1 KiB
JavaScript
1 line
5.1 KiB
JavaScript
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(target,value)=>__defProp(target,"name",{value:value,configurable:!0}),__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),__async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())}),stream_exports={};function gdflixExtractor(link,signal,axios,cheerio,headers){return __async(this,null,function*(){var _a,_b,_c,_d,_e,_f,_g,_h;try{const streamLinks=[],res=yield axios(`${link}`,{headers:headers,signal:signal});console.log("gdflixExtractor",link);const data=res.data;let $drive=cheerio.load(data);if(null==(_a=$drive("body").attr("onload"))?void 0:_a.includes("location.replace")){const newLink=null==(_d=null==(_c=null==(_b=$drive("body").attr("onload"))?void 0:_b.split("location.replace('"))?void 0:_c[1].split("'"))?void 0:_d[0];if(console.log("newLink",newLink),newLink){const newRes=yield axios.get(newLink,{headers:headers,signal:signal});$drive=cheerio.load(newRes.data)}}try{const baseUrl=link.split("/").slice(0,3).join("/"),resumeDrive=$drive(".btn-secondary").attr("href")||"";if(console.log("resumeDrive",resumeDrive),resumeDrive.includes("indexbot")){const resumeBotRes=yield axios.get(resumeDrive,{headers:headers}),resumeBotToken=resumeBotRes.data.match(/formData\.append\('token', '([a-f0-9]+)'\)/)[1],resumeBotBody=new FormData;resumeBotBody.append("token",resumeBotToken);const resumeBotPath=resumeBotRes.data.match(/fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/)[1],resumeBotBaseUrl=resumeDrive.split("/download")[0],resumeBotDownload=yield fetch(resumeBotBaseUrl+"/download?id="+resumeBotPath,{method:"POST",body:resumeBotBody,headers:{Referer:resumeDrive,Cookie:"PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308"}}),resumeBotDownloadData=yield resumeBotDownload.json();console.log("resumeBotDownloadData",resumeBotDownloadData.url),streamLinks.push({server:"ResumeBot",link:resumeBotDownloadData.url,type:"mkv"})}else{const url=baseUrl+resumeDrive,resumeDriveHtml=(yield axios.get(url,{headers:headers})).data,resumeLink=cheerio.load(resumeDriveHtml)(".btn-success").attr("href");resumeLink&&streamLinks.push({server:"ResumeCloud",link:resumeLink,type:"mkv"})}}catch(err){console.log("Resume link not found")}try{const seed=$drive(".btn-danger").attr("href")||"";if(console.log("seed",seed),seed.includes("?url=")){const instantToken=seed.split("=")[1],InstantFromData=new FormData;InstantFromData.append("keys",instantToken);const videoSeedUrl=seed.split("/").slice(0,3).join("/")+"/api",instantLinkRes=yield fetch(videoSeedUrl,{method:"POST",body:InstantFromData,headers:{"x-token":videoSeedUrl}}),instantLinkData=yield instantLinkRes.json();if(!1===instantLinkData.error){const instantLink=instantLinkData.url;streamLinks.push({server:"Gdrive-Instant",link:instantLink,type:"mkv"})}else console.log("Instant link not found",instantLinkData)}else{const newLinkRes=yield axios.head(seed,{headers:headers,signal:signal});console.log("newLinkRes",null==(_e=newLinkRes.request)?void 0:_e.responseURL);const newLink=(null==(_h=null==(_g=null==(_f=newLinkRes.request)?void 0:_f.responseURL)?void 0:_g.split("?url="))?void 0:_h[1])||seed;streamLinks.push({server:"G-Drive",link:newLink,type:"mkv"})}}catch(err){console.log("Instant link not found",err)}return streamLinks}catch(error){return console.log("gdflix error: ",error),[]}})}__export(stream_exports,{getStream:()=>getStream}),__name(gdflixExtractor,"gdflixExtractor");var getStream=__name(function(_0){return __async(this,arguments,function*({link:link,signal:signal,providerContext:providerContext}){const{axios:axios,cheerio:cheerio,commonHeaders:headers}=providerContext;try{const data=(yield axios.get(link,{signal:signal})).data,$=cheerio.load(data),streams=[],promises=$(".button2,.button1,.button3,.button4,.button").toArray().map(element=>__async(null,null,function*(){const title=$(element).text();let link2=$(element).attr("href");if(title.includes("GDFLIX")&&link2){const gdLinks=yield gdflixExtractor(link2,signal,axios,cheerio,headers);streams.push(...gdLinks)}const alreadyAdded=streams.find(s=>s.link===link2);!title||!link2||title.includes("Watch")||title.includes("Login")||title.includes("GoFile")||alreadyAdded||streams.push({server:title,link:link2,type:"mkv"})}));return yield Promise.all(promises),streams}catch(err){return console.error(err),[]}})},"getStream");exports.getStream=getStream; |