mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
1 line
3.2 KiB
JavaScript
1 line
3.2 KiB
JavaScript
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,a,o){return new(a||(a=Promise))(function(r,n){function i(e){try{s(o.next(e))}catch(e){n(e)}}function d(e){try{s(o.throw(e))}catch(e){n(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(i,d)}s((o=o.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=function(e){return __awaiter(this,arguments,void 0,function*({link:e,type:t,providerContext:a}){var o;const{axios:r,cheerio:n}=a,i={"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-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"};try{if("movie"===t){const t=(yield r.get(e,{headers:i})).data;e=n.load(t)('strong:contains("INSTANT")').parent().attr("href")||e}if(e.includes("fastilinks")){const t=(yield r.get(e,{headers:i})).data,a=n.load(t)('input[name="_csrf_token_645a83a41868941e4692aa31e7235f2"]').attr("value"),o=new FormData;o.append("_csrf_token_645a83a41868941e4692aa31e7235f2",a||"");const d=yield fetch(e,{method:"POST",headers:i,body:o}),s=yield d.text(),c=n.load(s);e=c('a:contains("mediafire")').attr("href")||c('a:contains("photolinx")').attr("href")||e}if(e.includes("photolinx")){const t=(yield r.get(e,{headers:i})).data,a=n.load(t),o=a("#generate_url").attr("data-token"),d={type:"DOWNLOAD_GENERATE",payload:{access_token:o,uid:a("#generate_url").attr("data-uid")}},s=yield fetch("https://photolinx.shop/action",{headers:{"sec-fetch-site":"same-origin","x-requested-with":"xmlhttprequest",cookie:"PHPSESSID=9a8d855c700cf0711831c04960c2e2b4",Referer:"https://photolinx.shop/download/5mPkrBD0D2x","Referrer-Policy":"strict-origin-when-cross-origin"},body:JSON.stringify(d),method:"POST"}),c=yield s.json(),l=null==c?void 0:c.download_url;if(l){return[{server:"Photolinx",link:l,type:"mkv"}]}}const a=(yield r.get(e,{headers:i})).data,d=[];let s={download:""};try{const t=(null===(o=a.match(/formData\.append\('key',\s*'(\d+)'\);/))||void 0===o?void 0:o[1])||"",r=new FormData;r.append("key",t);const n=yield fetch(e,{method:"POST",headers:i,body:r});s=yield n.json()}catch(e){}let c=n.load(a);const l=c('h1:contains("Download")').find("a").attr("href")||c(".input.popsok").attr("href");if(l){const t=(yield r.head(l)).headers["content-type"];if(t&&t.includes("video"))return d.push({server:"Mediafire",link:l,type:"mkv"}),d;{const t=(yield r.get(l,{headers:{Referer:e}})).data,a=/window\.location\.href\s*=\s*['"]([^'"]+)['"]/,o=t.match(a);let n=o?o[1]:null;return n&&d.push({server:"Mediafire",link:n,type:"mkv"}),d}}const h=(yield r.head(s.download)).headers["content-type"];if(h&&h.includes("video"))return d.push({server:"Mediafire",link:s.download,type:"mkv"}),d;{const t=(yield r.get(s.download,{headers:{Referer:e}})).data,a=n.load(t)("#continue-btn").attr("href"),o=yield r.get("https://www.mediafire.com"+a),i=n.load(o.data)(".input.popsok").attr("href");i&&d.push({server:"Mediafire",link:i,type:"mkv"})}return d}catch(e){return[]}})};exports.getStream=getStream; |