mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(function(n,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function s(t){try{c(i.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(o,s)}c((i=i.apply(t,e||[])).next())})};function extractKmhdLink(t,e){return __awaiter(this,void 0,void 0,function*(){const{axios:r}=e,i=(yield r.get(t)).data,n=i.match(/hubdrive_res:\s*"([^"]+)"/)[1];return i.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1]+n})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=function(t){return __awaiter(this,arguments,void 0,function*({link:t,signal:e,providerContext:r}){const{axios:i,cheerio:n,extractors:a}=r,{hubcloudExtracter:o,gdFlixExtracter:s}=a,c=[];try{if(t.includes("gdflix"))return yield s(t,e);if(t.includes("kmhd")){const i=yield extractKmhdLink(t,r);return yield o(i,e)}if(t.includes("gdflix")){try{const e=t.replace("/file","/zfile"),r=(yield i.get(e)).data,a=n.load(r)(".btn-success").attr("href");a&&c.push({server:"ResumeCloud",link:a,type:"mkv"})}catch(t){}try{const e=yield i.get(t,{timeout:1e4}),r=n.load(e.data)(".btn-danger").attr("href")||"",a=r.split("=")[1],o=new FormData;o.append("keys",a);const s=r.split("/").slice(0,3).join("/")+"/api",d=yield fetch(s,{method:"POST",body:o,headers:{"x-token":s}}),u=yield d.json();if(!1===u.error){const t=u.url;c.push({server:"Gdrive-Instant",link:t,type:"mkv"})}}catch(t){}return c}return yield o(t,e)}catch(t){return[]}})};exports.getStream=getStream; |