fix: update getMeta and getStream functions to improve link handling and extraction logic

This commit is contained in:
himanshu8443
2025-06-23 18:26:47 +05:30
parent dbd4cddfc9
commit 0dcab5e4f7
4 changed files with 137 additions and 9 deletions

View File

@@ -33,7 +33,9 @@ const getMeta = function (_a) {
.toFixed(1)
.toString();
const links = [];
$(".mb-center.maxbutton-5-center,.ep-button-container").map((i, element) => {
$(".custom-links")
.find(".ep-button-container")
.map((i, element) => {
var _a;
const title = $(element)
.text()
@@ -49,6 +51,34 @@ const getMeta = function (_a) {
});
}
});
if (links.length === 0) {
$(".ep-button-container:not(:has(a:contains('Click Here To Visit')))").map((i, element) => {
var _a;
let title = $(element)
.find("a")
.text()
.replace("\u2b07Download", "")
.replace("\u2b07 Download", "")
.trim();
if (title.includes("Download Now")) {
title = $(element)
.parent()
.find("h3")
.text()
.trim()
.replace("\u2b07Download", "")
.replace("\u2b07 Download", "");
}
const link = $(element).find("a").attr("href");
if (title && link) {
links.push({
title,
episodesLink: link,
quality: ((_a = title === null || title === void 0 ? void 0 : title.match(/\d+P\b/)) === null || _a === void 0 ? void 0 : _a[0].replace("P", "p")) || "",
});
}
});
}
return {
title,
tags,

View File

@@ -14,8 +14,40 @@ const getStream = (_a) => __awaiter(void 0, [_a], void 0, function* ({ link, sig
var _b;
try {
let newLink = link;
console.log("getStream 1", link);
if (link.includes("linkstore")) {
console.log("linkstore detected");
const res = yield fetch(link, {
signal,
headers: {
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
"cache-control": "no-cache",
pragma: "no-cache",
priority: "u=0, i",
"sec-ch-ua": '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
cookie: "PHPSESSID=9o57cff841dqtv8djtn1rp1712; ext_name=ojplmecpdpgccookcobabopnaifgidhf",
},
});
const html = yield res.text();
const refreshMetaMatch = html.match(/<meta\s+http-equiv="refresh"\s+content="[^"]*url=([^"]+)"/i);
if (refreshMetaMatch && refreshMetaMatch[1]) {
link = refreshMetaMatch[1];
}
}
else {
console.log("linkstore not detected");
}
console.log("getStream 2", link);
if (link.includes("luxedrive")) {
const res = yield providerContext.axios.get(link);
const res = yield providerContext.axios.get(link, { signal });
const $ = providerContext.cheerio.load(res.data);
const hubcloudLink = $("a.btn.hubcloud").attr("href");
if (hubcloudLink) {
@@ -28,7 +60,7 @@ const getStream = (_a) => __awaiter(void 0, [_a], void 0, function* ({ link, sig
}
}
}
if (newLink.includes("gdflix")) {
if (newLink.includes("flix")) {
const sreams = yield providerContext.extractors.gdFlixExtracter(newLink, signal);
return sreams;
}

View File

@@ -28,8 +28,9 @@ export const getMeta = async function ({
.toFixed(1)
.toString();
const links: Link[] = [];
$(".mb-center.maxbutton-5-center,.ep-button-container").map(
(i, element) => {
$(".custom-links")
.find(".ep-button-container")
.map((i, element) => {
const title = $(element)
.text()
.replace("\u2b07Download", "")
@@ -43,8 +44,36 @@ export const getMeta = async function ({
quality: title?.match(/\d+P\b/)?.[0].replace("P", "p") || "",
});
}
}
);
});
if (links.length === 0) {
$(
".ep-button-container:not(:has(a:contains('Click Here To Visit')))"
).map((i, element) => {
let title = $(element)
.find("a")
.text()
.replace("\u2b07Download", "")
.replace("\u2b07 Download", "")
.trim();
if (title.includes("Download Now")) {
title = $(element)
.parent()
.find("h3")
.text()
.trim()
.replace("\u2b07Download", "")
.replace("\u2b07 Download", "");
}
const link = $(element).find("a").attr("href");
if (title && link) {
links.push({
title,
episodesLink: link,
quality: title?.match(/\d+P\b/)?.[0].replace("P", "p") || "",
});
}
});
}
return {
title,
tags,

View File

@@ -12,8 +12,45 @@ export const getStream = async ({
}): Promise<Stream[]> => {
try {
let newLink = link;
console.log("getStream 1", link);
if (link.includes("linkstore")) {
console.log("linkstore detected");
const res = await fetch(link, {
signal,
headers: {
accept:
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "en-US,en;q=0.9,en-IN;q=0.8",
"cache-control": "no-cache",
pragma: "no-cache",
priority: "u=0, i",
"sec-ch-ua":
'"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
cookie:
"PHPSESSID=9o57cff841dqtv8djtn1rp1712; ext_name=ojplmecpdpgccookcobabopnaifgidhf",
},
});
const html = await res.text();
const refreshMetaMatch = html.match(
/<meta\s+http-equiv="refresh"\s+content="[^"]*url=([^"]+)"/i
);
if (refreshMetaMatch && refreshMetaMatch[1]) {
link = refreshMetaMatch[1];
}
} else {
console.log("linkstore not detected");
}
console.log("getStream 2", link);
if (link.includes("luxedrive")) {
const res = await providerContext.axios.get(link);
const res = await providerContext.axios.get(link, { signal });
const $ = providerContext.cheerio.load(res.data);
const hubcloudLink = $("a.btn.hubcloud").attr("href");
if (hubcloudLink) {
@@ -25,7 +62,7 @@ export const getStream = async ({
}
}
}
if (newLink.includes("gdflix")) {
if (newLink.includes("flix")) {
const sreams = await providerContext.extractors.gdFlixExtracter(
newLink,
signal