mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
1 line
1.4 KiB
JavaScript
1 line
1.4 KiB
JavaScript
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,r){function l(t){try{u(n.next(t))}catch(t){r(t)}}function a(t){try{u(n.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=function(t){return __awaiter(this,arguments,void 0,function*({link:t,providerContext:e}){try{const{getBaseUrl:i,axios:n}=e,o=yield i("consumet"),r=["vidcloud","vidstreaming"],l=`${o}/anime/zoro/watch?episodeId=${t}&server=`,a=[];return yield Promise.all(r.map(t=>__awaiter(this,void 0,void 0,function*(){var e,i;try{const o=yield n.get(l+t);if(o.data){const n=[];null===(e=o.data)||void 0===e||e.subtitles.forEach(t=>{var e,i;"Thumbnails"!==(null==t?void 0:t.lang)&&n.push({language:(null===(e=null==t?void 0:t.lang)||void 0===e?void 0:e.slice(0,2))||"Und",uri:null==t?void 0:t.url,title:(null==t?void 0:t.lang)||"Undefined",type:(null===(i=null==t?void 0:t.url)||void 0===i?void 0:i.endsWith(".vtt"))?"text/vtt":"application/x-subrip"})}),null===(i=o.data)||void 0===i||i.sources.forEach(e=>{a.push({server:t,link:null==e?void 0:e.url,type:(null==e?void 0:e.isM3U8)?"m3u8":"mp4",headers:{Referer:"https://megacloud.club/",Origin:"https://megacloud.club"},subtitles:n})})}}catch(t){}}))),a}catch(t){return[]}})};exports.getStream=getStream; |