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 }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0; exports.getStream = void 0;
exports.getRiveStream = getRiveStream; exports.getRiveStream = getRiveStream;
const types_1 = require("../types");
const getStream = (_a) => __awaiter(void 0, [_a], void 0, function* ({ link: id, type, providerContext, }) { const getStream = (_a) => __awaiter(void 0, [_a], void 0, function* ({ link: id, type, providerContext, }) {
try { try {
const streams = []; const streams = [];
@@ -79,8 +78,8 @@ function getRiveStream(tmdId, episode, season, type, Streams, providerContext) {
uri: sub === null || sub === void 0 ? void 0 : sub.file, uri: sub === null || sub === void 0 ? void 0 : sub.file,
title: (sub === null || sub === void 0 ? void 0 : sub.label) || "Undefined", 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")) type: ((_b = sub === null || sub === void 0 ? void 0 : sub.file) === null || _b === void 0 ? void 0 : _b.endsWith(".vtt"))
? types_1.TextTrackType.VTT ? "text/vtt"
: types_1.TextTrackType.SUBRIP, : "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 }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0; exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) { const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) { return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) {
var _b; var _b;
@@ -40,7 +39,7 @@ const getStream = function (_a) {
subtitles.push({ subtitles.push({
language: (_a = sub === null || sub === void 0 ? void 0 : sub.lang) === null || _a === void 0 ? void 0 : _a.slice(0, 2), 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, 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, 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 }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseUrl = void 0; exports.getBaseUrl = void 0;
const storage_1 = require("../storage");
// 1 hour // 1 hour
const expireTime = 60 * 60 * 1000; const expireTime = 60 * 60 * 1000;
const getBaseUrl = (providerValue) => __awaiter(void 0, void 0, void 0, function* () { const getBaseUrl = (providerValue) => __awaiter(void 0, void 0, void 0, function* () {
try { try {
let baseUrl = ''; let baseUrl = "";
const cacheKey = 'CacheBaseUrl' + providerValue; const cacheKey = "CacheBaseUrl" + providerValue;
const timeKey = 'baseUrlTime' + providerValue; const timeKey = "baseUrlTime" + providerValue;
const cachedUrl = storage_1.cacheStorageService.getString(cacheKey); // const cachedUrl = cacheStorageService.getString(cacheKey);
const cachedTime = storage_1.cacheStorageService.getObject(timeKey); // const cachedTime = cacheStorageService.getObject<number>(timeKey);
if (cachedUrl && // if (cachedUrl && cachedTime && Date.now() - cachedTime < expireTime) {
cachedTime && // baseUrl = cachedUrl;
Date.now() - cachedTime < expireTime) { // } else {
baseUrl = cachedUrl; const baseUrlRes = yield fetch("https://himanshu8443.github.io/providers/modflix.json");
}
else {
const baseUrlRes = yield fetch('https://himanshu8443.github.io/providers/modflix.json');
const baseUrlData = yield baseUrlRes.json(); const baseUrlData = yield baseUrlRes.json();
baseUrl = baseUrlData[providerValue].url; baseUrl = baseUrlData[providerValue].url;
storage_1.cacheStorageService.setString(cacheKey, baseUrl); // cacheStorageService.setString(cacheKey, baseUrl);
storage_1.cacheStorageService.setObject(timeKey, Date.now()); // cacheStorageService.setObject(timeKey, Date.now());
} // }
return baseUrl; return baseUrl;
} }
catch (error) { catch (error) {
console.error(`Error fetching baseUrl: ${providerValue}`, error); console.error(`Error fetching baseUrl: ${providerValue}`, error);
return ''; return "";
} }
}); });
exports.getBaseUrl = getBaseUrl; 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 }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0; exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) { const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) { return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) {
try { try {
@@ -34,8 +33,8 @@ const getStream = function (_a) {
uri: sub === null || sub === void 0 ? void 0 : sub.url, uri: sub === null || sub === void 0 ? void 0 : sub.url,
title: (sub === null || sub === void 0 ? void 0 : sub.lang) || "Undefined", 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")) type: ((_b = sub === null || sub === void 0 ? void 0 : sub.url) === null || _b === void 0 ? void 0 : _b.endsWith(".vtt"))
? types_1.TextTrackType.VTT ? "text/vtt"
: types_1.TextTrackType.SUBRIP, : "application/x-subrip",
}); });
}); });
(_b = res.data) === null || _b === void 0 ? void 0 : _b.sources.forEach((source) => { (_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 }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0; exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) { const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) { return __awaiter(this, arguments, void 0, function* ({ link: id, providerContext, }) {
var _b, _c, _d; var _b, _c, _d;
@@ -29,9 +28,7 @@ const getStream = function (_a) {
subtitles.push({ subtitles.push({
title: sub === null || sub === void 0 ? void 0 : sub.label, title: sub === null || sub === void 0 ? void 0 : sub.label,
language: sub === null || sub === void 0 ? void 0 : sub.land, 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")) 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",
? types_1.TextTrackType.VTT
: types_1.TextTrackType.SUBRIP,
uri: sub === null || sub === void 0 ? void 0 : sub.src, uri: sub === null || sub === void 0 ? void 0 : sub.src,
}); });
}); });

View File

@@ -22,7 +22,7 @@ const getEpisodes = function (_a) {
const episodes = []; const episodes = [];
container.find("h4").each((index, element) => { container.find("h4").each((index, element) => {
const el = $(element); const el = $(element);
const title = el.text().replaceAll("-", "").replaceAll(":", ""); const title = el.text().replace(/-/g, "").replace(/:/g, "");
const link = el const link = el
.next("p") .next("p")
.find('.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]') .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 }); Object.defineProperty(exports, "__esModule", { value: true });
exports.mpGetStream = void 0; exports.mpGetStream = void 0;
const types_1 = require("../types");
const mpGetStream = function (_a) { const mpGetStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: id, type, providerContext, }) { return __awaiter(this, arguments, void 0, function* ({ link: id, type, providerContext, }) {
var _b, _c; var _b, _c;
@@ -18,8 +17,8 @@ const mpGetStream = function (_a) {
const { getBaseUrl, cheerio } = providerContext; const { getBaseUrl, cheerio } = providerContext;
const streams = []; const streams = [];
const { season, episode, tmdbId } = JSON.parse(id); const { season, episode, tmdbId } = JSON.parse(id);
const baseUrl = yield getBaseUrl('moviesapi'); const baseUrl = yield getBaseUrl("moviesapi");
const link = type === 'movie' const link = type === "movie"
? `${baseUrl}/movie/${tmdbId}` ? `${baseUrl}/movie/${tmdbId}`
: `${baseUrl}/tv/${tmdbId}-${season}-${episode}`; : `${baseUrl}/tv/${tmdbId}-${season}-${episode}`;
const res = yield fetch(link, { const res = yield fetch(link, {
@@ -29,63 +28,61 @@ const mpGetStream = function (_a) {
}); });
const baseData = yield res.text(); const baseData = yield res.text();
const $ = cheerio.load(baseData); const $ = cheerio.load(baseData);
const embededUrl = $('iframe').attr('src') || ''; const embededUrl = $("iframe").attr("src") || "";
const response = yield fetch(embededUrl, { const response = yield fetch(embededUrl, {
credentials: 'omit', credentials: "omit",
headers: { 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",
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 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', "Accept-Language": "en-US,en;q=0.5",
'Alt-Used': 'w1.moviesapi.club', "Alt-Used": "w1.moviesapi.club",
'Upgrade-Insecure-Requests': '1', "Upgrade-Insecure-Requests": "1",
'Sec-Fetch-Dest': 'document', "Sec-Fetch-Dest": "document",
'Sec-Fetch-Mode': 'navigate', "Sec-Fetch-Mode": "navigate",
'Sec-Fetch-Site': 'none', "Sec-Fetch-Site": "none",
'Sec-Fetch-User': '?1', "Sec-Fetch-User": "?1",
Pragma: 'no-cache', Pragma: "no-cache",
'Cache-Control': 'no-cache', "Cache-Control": "no-cache",
referer: baseUrl, referer: baseUrl,
}, },
referrer: baseUrl, referrer: baseUrl,
method: 'GET', method: "GET",
mode: 'cors', mode: "cors",
}); });
const data2 = yield response.text(); const data2 = yield response.text();
// Extract the encrypted content // 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) { if (embededUrl) {
const res2 = yield fetch('https://ext.8man.me/api/decrypt?passphrase==JV[t}{trEV=Ilh5', { const res2 = yield fetch("https://ext.8man.me/api/decrypt?passphrase==JV[t}{trEV=Ilh5", {
method: 'POST', method: "POST",
body: contents, body: contents,
}); });
const finalData = yield res2.json(); 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) => { const subtitle = (_c = finalData === null || finalData === void 0 ? void 0 : finalData.subtitles) === null || _c === void 0 ? void 0 : _c.map((sub) => {
var _a; var _a;
return ({ 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, 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')) 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",
? types_1.TextTrackType.VTT
: types_1.TextTrackType.SUBRIP,
uri: sub === null || sub === void 0 ? void 0 : sub.file, uri: sub === null || sub === void 0 ? void 0 : sub.file,
}); });
}); });
streams.push({ streams.push({
server: 'vidstreaming ', server: "vidstreaming ",
type: 'm3u8', type: "m3u8",
subtitles: subtitle, subtitles: subtitle,
link: finalData === null || finalData === void 0 ? void 0 : finalData.videoUrl, link: finalData === null || finalData === void 0 ? void 0 : finalData.videoUrl,
headers: { 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, Referer: baseUrl,
Origin: baseUrl, Origin: baseUrl,
Accept: '*/*', Accept: "*/*",
'Accept-Language': 'en-US,en;q=0.5', "Accept-Language": "en-US,en;q=0.5",
'Sec-Fetch-Dest': 'empty', "Sec-Fetch-Dest": "empty",
'Sec-Fetch-Mode': 'cors', "Sec-Fetch-Mode": "cors",
'Sec-Fetch-Site': 'cross-site', "Sec-Fetch-Site": "cross-site",
Pragma: 'no-cache', Pragma: "no-cache",
'Cache-Control': '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 }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0; exports.getStream = void 0;
const types_1 = require("../types");
const getStream = function (_a) { const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: url, providerContext, }) { return __awaiter(this, arguments, void 0, function* ({ link: url, providerContext, }) {
var _b, _c, _d, _e, _f, _g, _h, _j, _k; var _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -114,7 +113,7 @@ const getStream = function (_a) {
subtitles.push({ subtitles.push({
language: lang, language: lang,
uri: sub, uri: sub,
type: types_1.TextTrackType.VTT, type: "text/vtt",
title: lang, title: lang,
}); });
}); });

View File

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