mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
unminify
This commit is contained in:
98
dist/moviesApi/stream.js
vendored
98
dist/moviesApi/stream.js
vendored
@@ -1 +1,97 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function c(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(c,a)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.mpGetStream=void 0;const mpGetStream=function(e){return __awaiter(this,arguments,void 0,function*({link:e,type:t,providerContext:i}){var n,r;try{const{getBaseUrl:o,cheerio:c}=i,a=[],{season:l,episode:s,tmdbId:d}=JSON.parse(e),u=yield o("moviesapi"),p="movie"===t?`${u}/movie/${d}`:`${u}/tv/${d}-${l}-${s}`,h=yield fetch(p,{headers:{referer:u}}),v=yield h.text(),m=c.load(v)("iframe").attr("src")||"",f=yield fetch(m,{credentials:"omit",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8","Accept-Language":"en-US,en;q=0.5","Alt-Used":"w1.moviesapi.club","Upgrade-Insecure-Requests":"1","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1",Pragma:"no-cache","Cache-Control":"no-cache",referer:u},referrer:u,method:"GET",mode:"cors"}),x=(null===(n=(yield f.text()).match(/const\s+Encrypted\s*=\s*['"]({.*})['"]/))||void 0===n?void 0:n[1])||"";if(m){const e=yield fetch("https://ext.8man.me/api/decrypt?passphrase==JV[t}{trEV=Ilh5",{method:"POST",body:x}),t=yield e.json(),i=null===(r=null==t?void 0:t.subtitles)||void 0===r?void 0:r.map(e=>{var t;return{title:(null==e?void 0:e.label)||"Unknown",language:null==e?void 0:e.label,type:(null===(t=null==e?void 0:e.file)||void 0===t?void 0:t.includes(".vtt"))?"text/vtt":"application/x-subrip",uri:null==e?void 0:e.file}});a.push({server:"vidstreaming ",type:"m3u8",subtitles:i,link:null==t?void 0:t.videoUrl,headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",Referer:u,Origin:u,Accept:"*/*","Accept-Language":"en-US,en;q=0.5","Sec-Fetch-Dest":"empty","Sec-Fetch-Mode":"cors","Sec-Fetch-Site":"cross-site",Pragma:"no-cache","Cache-Control":"no-cache"}})}return a}catch(e){return[]}})};exports.mpGetStream=mpGetStream;
|
||||
"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.mpGetStream = void 0;
|
||||
const mpGetStream = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ link: id, type, providerContext, }) {
|
||||
var _b, _c;
|
||||
try {
|
||||
const { getBaseUrl, cheerio } = providerContext;
|
||||
const streams = [];
|
||||
const { season, episode, tmdbId } = JSON.parse(id);
|
||||
const baseUrl = yield getBaseUrl("moviesapi");
|
||||
const link = type === "movie"
|
||||
? `${baseUrl}/movie/${tmdbId}`
|
||||
: `${baseUrl}/tv/${tmdbId}-${season}-${episode}`;
|
||||
const res = yield fetch(link, {
|
||||
headers: {
|
||||
referer: baseUrl,
|
||||
},
|
||||
});
|
||||
const baseData = yield res.text();
|
||||
const $ = cheerio.load(baseData);
|
||||
const embededUrl = $("iframe").attr("src") || "";
|
||||
const response = yield fetch(embededUrl, {
|
||||
credentials: "omit",
|
||||
headers: {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",
|
||||
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Alt-Used": "w1.moviesapi.club",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
Pragma: "no-cache",
|
||||
"Cache-Control": "no-cache",
|
||||
referer: baseUrl,
|
||||
},
|
||||
referrer: baseUrl,
|
||||
method: "GET",
|
||||
mode: "cors",
|
||||
});
|
||||
const data2 = yield response.text();
|
||||
// Extract the encrypted content
|
||||
const contents = ((_b = data2.match(/const\s+Encrypted\s*=\s*['"]({.*})['"]/)) === null || _b === void 0 ? void 0 : _b[1]) || "";
|
||||
if (embededUrl) {
|
||||
const res2 = yield fetch("https://ext.8man.me/api/decrypt?passphrase==JV[t}{trEV=Ilh5", {
|
||||
method: "POST",
|
||||
body: contents,
|
||||
});
|
||||
const finalData = yield res2.json();
|
||||
const subtitle = (_c = finalData === null || finalData === void 0 ? void 0 : finalData.subtitles) === null || _c === void 0 ? void 0 : _c.map((sub) => {
|
||||
var _a;
|
||||
return ({
|
||||
title: (sub === null || sub === void 0 ? void 0 : sub.label) || "Unknown",
|
||||
language: sub === null || sub === void 0 ? void 0 : sub.label,
|
||||
type: ((_a = sub === null || sub === void 0 ? void 0 : sub.file) === null || _a === void 0 ? void 0 : _a.includes(".vtt")) ? "text/vtt" : "application/x-subrip",
|
||||
uri: sub === null || sub === void 0 ? void 0 : sub.file,
|
||||
});
|
||||
});
|
||||
streams.push({
|
||||
server: "vidstreaming ",
|
||||
type: "m3u8",
|
||||
subtitles: subtitle,
|
||||
link: finalData === null || finalData === void 0 ? void 0 : finalData.videoUrl,
|
||||
headers: {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",
|
||||
Referer: baseUrl,
|
||||
Origin: baseUrl,
|
||||
Accept: "*/*",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Sec-Fetch-Dest": "empty",
|
||||
"Sec-Fetch-Mode": "cors",
|
||||
"Sec-Fetch-Site": "cross-site",
|
||||
Pragma: "no-cache",
|
||||
"Cache-Control": "no-cache",
|
||||
},
|
||||
});
|
||||
}
|
||||
return streams;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.mpGetStream = mpGetStream;
|
||||
|
||||
Reference in New Issue
Block a user