feat: Add base page worker and update instant link handling in getStream function

This commit is contained in:
Himanshu
2025-11-23 10:55:55 +05:30
parent f9768e67fe
commit 405c3fb47d
4 changed files with 120 additions and 25 deletions

View File

@@ -42,6 +42,7 @@ export const getStream = async ({
const driveRes = await axios.get(driveLink, { headers });
const driveHtml = driveRes.data;
const $drive = cheerio.load(driveHtml);
//instant link
try {
const seed = $drive(".btn-danger").attr("href") || "";
@@ -74,6 +75,35 @@ export const getStream = async ({
console.log("Instant link not found", err);
}
//*******
//instant link 2
//*******
try {
const seed = $drive(".btn-danger").attr("href") || "";
const newLinkRes = await fetch(seed, {
method: "HEAD",
headers,
redirect: "manual",
});
let newLink = seed;
if (newLinkRes.status >= 300 && newLinkRes.status < 400) {
newLink = newLinkRes.headers.get("location") || seed;
} else if (newLinkRes.url && newLinkRes.url !== seed) {
// Fallback: check if URL changed (redirect was followed)
newLink = newLinkRes.url || newLinkRes.url;
} else {
newLink = newLinkRes.headers.get("location") || seed;
}
console.log("Gdrive-Instant-2 link", newLink?.split("?url=")[1]);
ServerLinks.push({
server: "Gdrive-Instant-2",
link: newLink?.split("?url=")[1] || newLink,
type: "mkv",
});
} catch (err) {
console.log("Instant link not found", err);
}
// resume link
try {
const resumeDrive = driveLink.replace("/file", "/zfile");
@@ -94,6 +124,23 @@ export const getStream = async ({
console.log("Resume link not found");
}
// Base page worker
try {
const baseWorkerStream = $drive(".btn-success");
baseWorkerStream.each((i, el) => {
const link = (el as any).attribs?.href;
if (link) {
ServerLinks.push({
server: "Resume Worker " + (i + 1),
link: link,
type: "mkv",
});
}
});
} catch (err) {
console.log("Base page worker link not found", err);
}
// CF workers type 1
try {
const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=1";