This commit is contained in:
himanshu8443
2025-06-18 13:39:45 +05:30
parent a70757312e
commit c42d435bcc
10 changed files with 56 additions and 86 deletions

View File

@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0;
exports.getRiveStream = getRiveStream;
const types_1 = require("../types");
const getStream = (_a) => __awaiter(void 0, [_a], void 0, function* ({ link: id, type, providerContext, }) {
try {
const streams = [];
@@ -79,8 +78,8 @@ function getRiveStream(tmdId, episode, season, type, Streams, providerContext) {
uri: sub === null || sub === void 0 ? void 0 : sub.file,
title: (sub === null || sub === void 0 ? void 0 : sub.label) || "Undefined",
type: ((_b = sub === null || sub === void 0 ? void 0 : sub.file) === null || _b === void 0 ? void 0 : _b.endsWith(".vtt"))
? types_1.TextTrackType.VTT
: types_1.TextTrackType.SUBRIP,
? "text/vtt"
: "application/x-subrip",
});
});
}

View File

@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) {
var _b;
@@ -40,7 +39,7 @@ const getStream = function (_a) {
subtitles.push({
language: (_a = sub === null || sub === void 0 ? void 0 : sub.lang) === null || _a === void 0 ? void 0 : _a.slice(0, 2),
uri: sub === null || sub === void 0 ? void 0 : sub.url,
type: types_1.TextTrackType.VTT,
type: "text/vtt",
title: sub === null || sub === void 0 ? void 0 : sub.lang,
});
});

30
dist/getBaseUrl.js vendored
View File

@@ -10,33 +10,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseUrl = void 0;
const storage_1 = require("../storage");
// 1 hour
const expireTime = 60 * 60 * 1000;
const getBaseUrl = (providerValue) => __awaiter(void 0, void 0, void 0, function* () {
try {
let baseUrl = '';
const cacheKey = 'CacheBaseUrl' + providerValue;
const timeKey = 'baseUrlTime' + providerValue;
const cachedUrl = storage_1.cacheStorageService.getString(cacheKey);
const cachedTime = storage_1.cacheStorageService.getObject(timeKey);
if (cachedUrl &&
cachedTime &&
Date.now() - cachedTime < expireTime) {
baseUrl = cachedUrl;
}
else {
const baseUrlRes = yield fetch('https://himanshu8443.github.io/providers/modflix.json');
let baseUrl = "";
const cacheKey = "CacheBaseUrl" + providerValue;
const timeKey = "baseUrlTime" + providerValue;
// const cachedUrl = cacheStorageService.getString(cacheKey);
// const cachedTime = cacheStorageService.getObject<number>(timeKey);
// if (cachedUrl && cachedTime && Date.now() - cachedTime < expireTime) {
// baseUrl = cachedUrl;
// } else {
const baseUrlRes = yield fetch("https://himanshu8443.github.io/providers/modflix.json");
const baseUrlData = yield baseUrlRes.json();
baseUrl = baseUrlData[providerValue].url;
storage_1.cacheStorageService.setString(cacheKey, baseUrl);
storage_1.cacheStorageService.setObject(timeKey, Date.now());
}
// cacheStorageService.setString(cacheKey, baseUrl);
// cacheStorageService.setObject(timeKey, Date.now());
// }
return baseUrl;
}
catch (error) {
console.error(`Error fetching baseUrl: ${providerValue}`, error);
return '';
return "";
}
});
exports.getBaseUrl = getBaseUrl;

View File

@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) {
try {
@@ -34,8 +33,8 @@ const getStream = function (_a) {
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"))
? types_1.TextTrackType.VTT
: types_1.TextTrackType.SUBRIP,
? "text/vtt"
: "application/x-subrip",
});
});
(_b = res.data) === null || _b === void 0 ? void 0 : _b.sources.forEach((source) => {

View File

@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) {
var _b, _c, _d;
@@ -29,9 +28,7 @@ const getStream = function (_a) {
subtitles.push({
title: sub === null || sub === void 0 ? void 0 : sub.label,
language: sub === null || sub === void 0 ? void 0 : sub.land,
type: ((_a = sub === null || sub === void 0 ? void 0 : sub.src) === null || _a === void 0 ? void 0 : _a.includes(".vtt"))
? types_1.TextTrackType.VTT
: types_1.TextTrackType.SUBRIP,
type: ((_a = sub === null || sub === void 0 ? void 0 : sub.src) === null || _a === void 0 ? void 0 : _a.includes(".vtt")) ? "text/vtt" : "application/x-subrip",
uri: sub === null || sub === void 0 ? void 0 : sub.src,
});
});

View File

@@ -22,7 +22,7 @@ const getEpisodes = function (_a) {
const episodes = [];
container.find("h4").each((index, element) => {
const el = $(element);
const title = el.text().replaceAll("-", "").replaceAll(":", "");
const title = el.text().replace(/-/g, "").replace(/:/g, "");
const link = el
.next("p")
.find('.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]')

View File

@@ -1,16 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.moviesApi = void 0;
const catalog_1 = require("../autoEmbed/catalog");
const module_1 = require();
";;
const posts_1 = require("../autoEmbed/posts");
const stream_1 = require("./stream");
exports.moviesApi = {
catalog: catalog_1.allCatalog,
genres: catalog_1.allGenresList,
GetMetaData: module_1.allGetInfo,
GetHomePosts: posts_1.allGetPost,
GetStream: stream_1.mpGetStream,
GetSearchPosts: posts_1.allGetSearchPosts,
};

View File

@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mpGetStream = void 0;
const types_1 = require("../types");
const mpGetStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, type, providerContext, }) {
var _b, _c;
@@ -18,8 +17,8 @@ const mpGetStream = function (_a) {
const { getBaseUrl, cheerio } = providerContext;
const streams = [];
const { season, episode, tmdbId } = JSON.parse(id);
const baseUrl = yield getBaseUrl('moviesapi');
const link = type === 'movie'
const baseUrl = yield getBaseUrl("moviesapi");
const link = type === "movie"
? `${baseUrl}/movie/${tmdbId}`
: `${baseUrl}/tv/${tmdbId}-${season}-${episode}`;
const res = yield fetch(link, {
@@ -29,63 +28,61 @@ const mpGetStream = function (_a) {
});
const baseData = yield res.text();
const $ = cheerio.load(baseData);
const embededUrl = $('iframe').attr('src') || '';
const embededUrl = $("iframe").attr("src") || "";
const response = yield fetch(embededUrl, {
credentials: 'omit',
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',
"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',
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]) || '';
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',
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',
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'))
? types_1.TextTrackType.VTT
: types_1.TextTrackType.SUBRIP,
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',
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',
"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',
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",
},
});
}

View File

@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: url, providerContext, }) {
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -114,7 +113,7 @@ const getStream = function (_a) {
subtitles.push({
language: lang,
uri: sub,
type: types_1.TextTrackType.VTT,
type: "text/vtt",
title: lang,
});
});

View File

@@ -22,7 +22,7 @@ const getEpisodes = function (_a) {
const episodes = [];
container.find("h4").each((index, element) => {
const el = $(element);
const title = el.text().replaceAll("-", "").replaceAll(":", "");
const title = el.text().replace(/-/g, "").replace(/:/g, "");
const link = el
.next("p")
.find('.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]')