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

2
dist/mod/stream.js vendored

File diff suppressed because one or more lines are too long

2
dist/uhd/stream.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -141,6 +141,22 @@ export const getStream = async function ({
} catch (err) {
console.log("ResumeBot link not found", err);
}
// Base page worker
try {
const baseWorkerStream = $drive(".btn-success");
baseWorkerStream.each((i, el) => {
const link = (el as any).attribs?.href;
if (link) {
servers.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";
@@ -185,37 +201,69 @@ export const getStream = async function ({
// gdrive
//instant link
//*******
//instant link 1
//*******
// try {
// const seed = $drive(".btn-danger").attr("href") || "";
// const instantToken = seed.split("=")[1];
// console.log("InstantToken", instantToken);
// const InstantFromData = new FormData();
// InstantFromData.append("keys", instantToken);
// const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api";
// console.log("videoSeedUrl", videoSeedUrl);
// const instantLinkRes = await fetch(videoSeedUrl, {
// method: "POST",
// body: InstantFromData,
// headers: {
// "x-token": videoSeedUrl,
// },
// });
// const instantLinkData = await instantLinkRes.json();
// // console.log('instantLinkData', instantLinkData);
// if (instantLinkData.error === false) {
// const instantLink = instantLinkData.url;
// servers.push({
// server: "Gdrive-Instant",
// link: instantLink,
// type: "mkv",
// });
// } else {
// console.log("Instant link not found", instantLinkData);
// }
// } catch (err) {
// console.log("Instant link not found", err);
// }
//*******
//instant link 2
//*******
try {
const seed = $drive(".btn-danger").attr("href") || "";
const instantToken = seed.split("=")[1];
// console.log('InstantToken', instantToken);
const InstantFromData = new FormData();
InstantFromData.append("keys", instantToken);
const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api";
// console.log('videoSeedUrl', videoSeedUrl);
const instantLinkRes = await fetch(videoSeedUrl, {
method: "POST",
body: InstantFromData,
headers: {
"x-token": videoSeedUrl,
},
const newLinkRes = await fetch(seed, {
method: "HEAD",
headers,
redirect: "manual",
});
const instantLinkData = await instantLinkRes.json();
// console.log('instantLinkData', instantLinkData);
if (instantLinkData.error === false) {
const instantLink = instantLinkData.url;
servers.push({
server: "Gdrive-Instant",
link: instantLink,
type: "mkv",
});
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 {
console.log("Instant link not found", instantLinkData);
newLink = newLinkRes.headers.get("location") || seed;
}
console.log("Gdrive-Instant-2 link", newLink?.split("?url=")[1]);
servers.push({
server: "Gdrive-Instant-2",
link: newLink?.split("?url=")[1] || newLink,
type: "mkv",
});
} catch (err) {
console.log("Instant link not found", err);
}
return servers;
} catch (err) {
console.log("getStream error", err);

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";