mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
minify
This commit is contained in:
67
dist/hiAnime/stream.js
vendored
67
dist/hiAnime/stream.js
vendored
@@ -1,66 +1 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getStream = void 0;
|
||||
const getStream = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) {
|
||||
try {
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = yield getBaseUrl("consumet");
|
||||
const servers = ["vidcloud", "vidstreaming"];
|
||||
const url = `${baseUrl}/anime/zoro/watch?episodeId=${id}&server=`;
|
||||
const streamLinks = [];
|
||||
yield Promise.all(servers.map((server) => __awaiter(this, void 0, void 0, function* () {
|
||||
var _a, _b;
|
||||
try {
|
||||
const res = yield axios.get(url + server);
|
||||
if (res.data) {
|
||||
const subtitles = [];
|
||||
(_a = res.data) === null || _a === void 0 ? void 0 : _a.subtitles.forEach((sub) => {
|
||||
var _a, _b;
|
||||
if ((sub === null || sub === void 0 ? void 0 : sub.lang) === "Thumbnails")
|
||||
return;
|
||||
subtitles.push({
|
||||
language: ((_a = sub === null || sub === void 0 ? void 0 : sub.lang) === null || _a === void 0 ? void 0 : _a.slice(0, 2)) || "Und",
|
||||
uri: sub === null || sub === void 0 ? void 0 : sub.url,
|
||||
title: (sub === null || sub === void 0 ? void 0 : sub.lang) || "Undefined",
|
||||
type: ((_b = sub === null || sub === void 0 ? void 0 : sub.url) === null || _b === void 0 ? void 0 : _b.endsWith(".vtt"))
|
||||
? "text/vtt"
|
||||
: "application/x-subrip",
|
||||
});
|
||||
});
|
||||
(_b = res.data) === null || _b === void 0 ? void 0 : _b.sources.forEach((source) => {
|
||||
streamLinks.push({
|
||||
server: server,
|
||||
link: source === null || source === void 0 ? void 0 : source.url,
|
||||
type: (source === null || source === void 0 ? void 0 : source.isM3U8) ? "m3u8" : "mp4",
|
||||
headers: {
|
||||
Referer: "https://megacloud.club/",
|
||||
Origin: "https://megacloud.club",
|
||||
},
|
||||
subtitles: subtitles,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
})));
|
||||
return streamLinks;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getStream = getStream;
|
||||
"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;
|
||||
Reference in New Issue
Block a user