mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
1 line
7.3 KiB
JavaScript
1 line
7.3 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={};__export(stream_exports,{getStream:()=>getStream});var headers={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Cache-Control":"no-store","Accept-Language":"en-US,en;q=0.9",DNT:"1","sec-ch-ua":'"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate",Cookie:"popads_user_id=6ba8fe60a481387a3249f05aa058822d","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0"},getStream=__name(function(_0){return __async(this,arguments,function*({link:url,type:type,providerContext:providerContext}){var _a,_b;const{axios:axios,cheerio:cheerio}=providerContext;try{const modGetEpisodeLinks=__name(function(_02){return __async(this,arguments,function*({url:url2,providerContext:providerContext2}){var _a2;const{axios:axios2,cheerio:cheerio2}=providerContext2;try{url2.includes("url=")&&(url2=atob(url2.split("url=")[1]));const html=(yield axios2.get(url2)).data;let $=cheerio2.load(html);if(url2.includes("url=")){const newUrl=null==(_a2=$("meta[http-equiv='refresh']").attr("content"))?void 0:_a2.split("url=")[1],html2=(yield axios2.get(newUrl||url2)).data;$=cheerio2.load(html2)}const episodeLinks=[];return $("h3,h4").map((i,element)=>{const seriesTitle=$(element).text(),episodesLink=$(element).find("a").attr("href");episodesLink&&"#"!==episodesLink&&episodeLinks.push({title:seriesTitle.trim()||"No title found",link:episodesLink||""})}),$("a.maxbutton").map((i,element)=>{const seriesTitle=$(element).children("span").text(),episodesLink=$(element).attr("href");episodesLink&&"#"!==episodesLink&&episodeLinks.push({title:seriesTitle.trim()||"No title found",link:episodesLink||""})}),episodeLinks}catch(err){return console.error(err),[]}})},"modGetEpisodeLinks");console.log("modGetStream",type,url),"movie"===type&&(url=(yield modGetEpisodeLinks({url:url,providerContext:providerContext}))[0].link||url);let downloadLink=yield modExtractor(url,providerContext);const ddl=(null==(_b=null==(_a=null==downloadLink?void 0:downloadLink.data)?void 0:_a.match(/content="0;url=(.*?)"/))?void 0:_b[1])||url,servers=[],driveLink=yield isDriveLink(ddl),driveHtml=(yield axios.get(driveLink,{headers:headers})).data,$drive=cheerio.load(driveHtml);try{const resumeBot=$drive(".btn.btn-light").attr("href")||"",resumeBotRes=yield axios.get(resumeBot,{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=resumeBot.split("/download")[0],resumeBotDownload=yield fetch(resumeBotBaseUrl+"/download?id="+resumeBotPath,{method:"POST",body:resumeBotBody,headers:{Referer:resumeBot,Cookie:"PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308"}}),resumeBotDownloadData=yield resumeBotDownload.json();console.log("resumeBotDownloadData",resumeBotDownloadData.url),servers.push({server:"ResumeBot",link:resumeBotDownloadData.url,type:"mkv"})}catch(err){console.log("ResumeBot link not found",err)}try{$drive(".btn-success").each((i,el)=>{var _a2;const link=null==(_a2=el.attribs)?void 0:_a2.href;link&&servers.push({server:"Resume Worker "+(i+1),link:link,type:"mkv"})})}catch(err){console.log("Base page worker link not found",err)}try{const cfWorkersLink=driveLink.replace("/file","/wfile")+"?type=1",cfWorkersHtml=(yield axios.get(cfWorkersLink,{headers:headers})).data;cheerio.load(cfWorkersHtml)(".btn-success").each((i,el)=>{var _a2;const link=null==(_a2=el.attribs)?void 0:_a2.href;link&&servers.push({server:"Cf Worker 1."+i,link:link,type:"mkv"})})}catch(err){console.log("CF workers link not found",err)}try{const cfWorkersLink=driveLink.replace("/file","/wfile")+"?type=2",cfWorkersHtml=(yield axios.get(cfWorkersLink,{headers:headers})).data;cheerio.load(cfWorkersHtml)(".btn-success").each((i,el)=>{var _a2;const link=null==(_a2=el.attribs)?void 0:_a2.href;link&&servers.push({server:"Cf Worker 2."+i,link:link,type:"mkv"})})}catch(err){console.log("CF workers link not found",err)}try{const seed=$drive(".btn-danger").attr("href")||"",newLinkRes=yield fetch(seed,{method:"HEAD",headers:headers,redirect:"manual"});let newLink=seed;newLink=newLinkRes.status>=300&&newLinkRes.status<400?newLinkRes.headers.get("location")||seed:newLinkRes.url&&newLinkRes.url!==seed?newLinkRes.url||newLinkRes.url:newLinkRes.headers.get("location")||seed,console.log("Gdrive-Instant-2 link",null==newLink?void 0:newLink.split("?url=")[1]),servers.push({server:"Gdrive-Instant-2",link:(null==newLink?void 0:newLink.split("?url=")[1])||newLink,type:"mkv"})}catch(err){console.log("Instant link not found",err)}return servers}catch(err){return console.log("getStream error",err),[]}})},"getStream"),isDriveLink=__name(ddl=>__async(null,null,function*(){if(ddl.includes("drive")){const driveLeach=yield fetch(ddl),pathMatch=(yield driveLeach.text()).match(/window\.location\.replace\("([^"]+)"\)/),path=null==pathMatch?void 0:pathMatch[1],mainUrl=ddl.split("/")[2];return console.log(`driveUrl = https://${mainUrl}${path}`),`https://${mainUrl}${path}`}return ddl}),"isDriveLink");function modExtractor(url,providerContext){return __async(this,null,function*(){const{axios:axios,cheerio:cheerio}=providerContext;try{const wpHttp=url.split("sid=")[1];var bodyFormData0=new FormData;bodyFormData0.append("_wp_http",wpHttp);const res=yield fetch(url.split("?")[0],{method:"POST",body:bodyFormData0}),html=yield res.text(),$=cheerio.load(html),wpHttp2=$("input").attr("name","_wp_http2").val();console.log("wpHttp2",wpHttp2);var bodyFormData=new FormData;bodyFormData.append("_wp_http2",wpHttp2);const formUrl=$("form").attr("action")||url.split("?")[0],res2=yield fetch(formUrl,{method:"POST",body:bodyFormData}),link=(yield res2.text()).match(/setAttribute\("href",\s*"(.*?)"/)[1];console.log(link);const cookie=link.split("=")[1];return console.log("cookie",cookie),yield axios.get(link,{headers:{Referer:formUrl,Cookie:`${cookie}=${wpHttp2}`}})}catch(err){console.log("modGetStream error",err)}})}__name(modExtractor,"modExtractor"),exports.getStream=getStream; |