mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
Revert "feat: add extractors bundled in file refactor stream handling in multiple providers"
This reverts commit 13d41f9da6.
This commit is contained in:
@@ -1,174 +0,0 @@
|
||||
export async function gdflixExtractor(
|
||||
link: string,
|
||||
signal: AbortSignal,
|
||||
axios: any,
|
||||
cheerio: any,
|
||||
headers: Record<string, string>,
|
||||
) {
|
||||
try {
|
||||
const streamLinks: any[] = [];
|
||||
const res = await axios(`${link}`, { headers, signal });
|
||||
console.log("gdflixExtractor", link);
|
||||
const data = res.data;
|
||||
let $drive = cheerio.load(data);
|
||||
// handle if redirected to another link
|
||||
|
||||
if ($drive("body").attr("onload")?.includes("location.replace")) {
|
||||
const newLink = $drive("body")
|
||||
.attr("onload")
|
||||
?.split("location.replace('")?.[1]
|
||||
.split("'")?.[0];
|
||||
|
||||
console.log("newLink", newLink);
|
||||
if (newLink) {
|
||||
const newRes = await axios.get(newLink, { headers, signal });
|
||||
$drive = cheerio.load(newRes.data);
|
||||
}
|
||||
}
|
||||
|
||||
// try {
|
||||
// const resumeBot = $drive('.fab.fa-artstation').prev().attr('href') || '';
|
||||
// console.log('resumeBot', resumeBot);
|
||||
// const resumeBotRes = await axios.get(resumeBot, {headers});
|
||||
// const resumeBotToken = resumeBotRes.data.match(
|
||||
// /formData\.append\('token', '([a-f0-9]+)'\)/,
|
||||
// )[1];
|
||||
// const resumeBotBody = new FormData();
|
||||
// resumeBotBody.append('token', resumeBotToken);
|
||||
// const resumeBotPath = resumeBotRes.data.match(
|
||||
// /fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/,
|
||||
// )[1];
|
||||
// const resumeBotBaseUrl = resumeBot.split('/download')[0];
|
||||
// // console.log(
|
||||
// // 'resumeBotPath',
|
||||
// // resumeBotBaseUrl + '/download?id=' + resumeBotPath,
|
||||
// // );
|
||||
// // console.log('resumeBotBody', resumeBotToken);
|
||||
|
||||
// const resumeBotDownload = await fetch(
|
||||
// resumeBotBaseUrl + '/download?id=' + resumeBotPath,
|
||||
// {
|
||||
// method: 'POST',
|
||||
// body: resumeBotBody,
|
||||
// headers: {
|
||||
// Referer: resumeBot,
|
||||
// Cookie: 'PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308',
|
||||
// },
|
||||
// },
|
||||
// );
|
||||
// const resumeBotDownloadData = await resumeBotDownload.json();
|
||||
// console.log('resumeBotDownloadData', resumeBotDownloadData.url);
|
||||
// streamLinks.push({
|
||||
// server: 'ResumeBot',
|
||||
// link: resumeBotDownloadData.url,
|
||||
// type: 'mkv',
|
||||
// });
|
||||
// } catch (err) {
|
||||
// console.log('ResumeBot link not found', err);
|
||||
// }
|
||||
|
||||
/// resume cloud
|
||||
try {
|
||||
const baseUrl = link.split("/").slice(0, 3).join("/");
|
||||
const resumeDrive = $drive(".btn-secondary").attr("href") || "";
|
||||
console.log("resumeDrive", resumeDrive);
|
||||
if (resumeDrive.includes("indexbot")) {
|
||||
const resumeBotRes = await axios.get(resumeDrive, { headers });
|
||||
const resumeBotToken = resumeBotRes.data.match(
|
||||
/formData\.append\('token', '([a-f0-9]+)'\)/,
|
||||
)[1];
|
||||
const resumeBotBody = new FormData();
|
||||
resumeBotBody.append("token", resumeBotToken);
|
||||
const resumeBotPath = resumeBotRes.data.match(
|
||||
/fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/,
|
||||
)[1];
|
||||
const resumeBotBaseUrl = resumeDrive.split("/download")[0];
|
||||
// console.log(
|
||||
// 'resumeBotPath',
|
||||
// resumeBotBaseUrl + '/download?id=' + resumeBotPath,
|
||||
// );
|
||||
// console.log('resumeBotBody', resumeBotToken);
|
||||
|
||||
const resumeBotDownload = await fetch(
|
||||
resumeBotBaseUrl + "/download?id=" + resumeBotPath,
|
||||
{
|
||||
method: "POST",
|
||||
body: resumeBotBody,
|
||||
headers: {
|
||||
Referer: resumeDrive,
|
||||
Cookie: "PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308",
|
||||
},
|
||||
},
|
||||
);
|
||||
const resumeBotDownloadData = await resumeBotDownload.json();
|
||||
console.log("resumeBotDownloadData", resumeBotDownloadData.url);
|
||||
streamLinks.push({
|
||||
server: "ResumeBot",
|
||||
link: resumeBotDownloadData.url,
|
||||
type: "mkv",
|
||||
});
|
||||
} else {
|
||||
const url = baseUrl + resumeDrive;
|
||||
const resumeDriveRes = await axios.get(url, { headers });
|
||||
const resumeDriveHtml = resumeDriveRes.data;
|
||||
const $resumeDrive = cheerio.load(resumeDriveHtml);
|
||||
const resumeLink = $resumeDrive(".btn-success").attr("href");
|
||||
// console.log('resumeLink', resumeLink);
|
||||
if (resumeLink) {
|
||||
streamLinks.push({
|
||||
server: "ResumeCloud",
|
||||
link: resumeLink,
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("Resume link not found");
|
||||
}
|
||||
|
||||
//instant link
|
||||
try {
|
||||
const seed = $drive(".btn-danger").attr("href") || "";
|
||||
console.log("seed", seed);
|
||||
if (!seed.includes("?url=")) {
|
||||
const newLinkRes = await axios.head(seed, { headers, signal });
|
||||
console.log("newLinkRes", newLinkRes.request?.responseURL);
|
||||
const newLink =
|
||||
newLinkRes.request?.responseURL?.split("?url=")?.[1] || seed;
|
||||
streamLinks.push({ server: "G-Drive", link: newLink, type: "mkv" });
|
||||
} else {
|
||||
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;
|
||||
streamLinks.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);
|
||||
}
|
||||
return streamLinks;
|
||||
} catch (error) {
|
||||
console.log("gdflix error: ", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
export async function gofileExtractor(
|
||||
id: string,
|
||||
axios: any,
|
||||
): Promise<{ link: string; token: string }> {
|
||||
try {
|
||||
const gofileRes = await axios.get("https://gofile.io/d/" + id);
|
||||
const genAccountres = await axios.post("https://api.gofile.io/accounts");
|
||||
const token = genAccountres.data.data.token;
|
||||
console.log("gofile token", token);
|
||||
|
||||
const wtRes = await axios.get("https://gofile.io/dist/js/global.js");
|
||||
const wt = wtRes.data.match(/appdata\.wt\s*=\s*["']([^"']+)["']/)[1];
|
||||
console.log("gofile wt", wt);
|
||||
|
||||
const res = await axios.get(
|
||||
`https://api.gofile.io/contents/${id}?wt=${wt}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
const oId = Object.keys(res.data.data.children)[0];
|
||||
console.log("gofileExtractor", res.data.data.children[oId].link);
|
||||
const link = res.data.data.children[oId].link;
|
||||
return {
|
||||
link,
|
||||
token,
|
||||
};
|
||||
} catch (e) {
|
||||
console.log("gofileExtractor error", e);
|
||||
return {
|
||||
link: "",
|
||||
token: "",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
const hubcloudDecode = function (value: string) {
|
||||
if (value === undefined) {
|
||||
return "";
|
||||
}
|
||||
return atob(value.toString());
|
||||
};
|
||||
|
||||
export async function hubcloudExtractor(
|
||||
link: string,
|
||||
signal: AbortSignal,
|
||||
axios: any,
|
||||
cheerio: any,
|
||||
headers: Record<string, string>,
|
||||
) {
|
||||
try {
|
||||
headers["Cookie"] =
|
||||
"ext_name=ojplmecpdpgccookcobabopnaifgidhf; xla=s4t; cf_clearance=woQrFGXtLfmEMBEiGUsVHrUBMT8s3cmguIzmMjmvpkg-1770053679-1.2.1.1-xBrQdciOJsweUF6F2T_OtH6jmyanN_TduQ0yslc_XqjU6RcHSxI7.YOKv6ry7oYo64868HYoULnVyww536H2eVI3R2e4wKzsky6abjPdfQPxqpUaXjxfJ02o6jl3_Vkwr4uiaU7Wy596Vdst3y78HXvVmKdIohhtPvp.vZ9_L7wvWdce0GRixjh_6JiqWmWMws46hwEt3hboaS1e1e4EoWCvj5b0M_jVwvSxBOAW5emFzvT3QrnRh4nyYmKDERnY";
|
||||
console.log("hubcloudExtractor", link);
|
||||
console.log("headers", headers);
|
||||
const baseUrl = link.split("/").slice(0, 3).join("/");
|
||||
const streamLinks: any[] = [];
|
||||
const vLinkRes = await axios(`${link}`, { headers, signal });
|
||||
const vLinkText = vLinkRes.data;
|
||||
const $vLink = cheerio.load(vLinkText);
|
||||
const vLinkRedirect = vLinkText.match(/var\s+url\s*=\s*'([^']+)';/) || [];
|
||||
let vcloudLink =
|
||||
hubcloudDecode(vLinkRedirect[1]?.split("r=")?.[1]) ||
|
||||
vLinkRedirect[1] ||
|
||||
$vLink(".fa-file-download.fa-lg").parent().attr("href") ||
|
||||
link;
|
||||
console.log("vcloudLink", vcloudLink);
|
||||
if (vcloudLink?.startsWith("/")) {
|
||||
vcloudLink = `${baseUrl}${vcloudLink}`;
|
||||
console.log("New vcloudLink", vcloudLink);
|
||||
}
|
||||
const vcloudRes = await fetch(vcloudLink, {
|
||||
headers,
|
||||
signal,
|
||||
redirect: "follow",
|
||||
});
|
||||
const $ = cheerio.load(await vcloudRes.text());
|
||||
// console.log('vcloudRes', $.text());
|
||||
|
||||
const linkClass = $(".btn-success.btn-lg.h6,.btn-danger,.btn-secondary");
|
||||
for (const element of linkClass) {
|
||||
const itm = $(element);
|
||||
let link = itm.attr("href") || "";
|
||||
|
||||
switch (true) {
|
||||
case link?.includes("pixeld"):
|
||||
if (!link?.includes("api")) {
|
||||
const token = link.split("/").pop();
|
||||
const baseUrl = link.split("/").slice(0, -2).join("/");
|
||||
link = `${baseUrl}/api/file/${token}?download`;
|
||||
}
|
||||
streamLinks.push({ server: "Pixeldrain", link: link, type: "mkv" });
|
||||
break;
|
||||
|
||||
case link?.includes(".dev") && !link?.includes("/?id="):
|
||||
streamLinks.push({ server: "Cf Worker", link: link, type: "mkv" });
|
||||
break;
|
||||
|
||||
case link?.includes("hubcloud") || link?.includes("/?id="):
|
||||
try {
|
||||
const newLinkRes = await fetch(link, {
|
||||
method: "HEAD",
|
||||
headers,
|
||||
signal,
|
||||
redirect: "manual",
|
||||
});
|
||||
|
||||
// Check if response is a redirect (301, 302, etc.)
|
||||
let newLink = link;
|
||||
if (newLinkRes.status >= 300 && newLinkRes.status < 400) {
|
||||
newLink = newLinkRes.headers.get("location") || link;
|
||||
} else if (newLinkRes.url && newLinkRes.url !== link) {
|
||||
// Fallback: check if URL changed (redirect was followed)
|
||||
newLink = newLinkRes.url;
|
||||
} else {
|
||||
newLink = newLinkRes.headers.get("location") || link;
|
||||
}
|
||||
if (newLink.includes("googleusercontent")) {
|
||||
newLink = newLink.split("?link=")[1];
|
||||
} else {
|
||||
const newLinkRes2 = await fetch(newLink, {
|
||||
method: "HEAD",
|
||||
headers,
|
||||
signal,
|
||||
redirect: "manual",
|
||||
});
|
||||
|
||||
// Check if response is a redirect
|
||||
if (newLinkRes2.status >= 300 && newLinkRes2.status < 400) {
|
||||
newLink =
|
||||
newLinkRes2.headers.get("location")?.split("?link=")[1] ||
|
||||
newLink;
|
||||
} else if (newLinkRes2.url && newLinkRes2.url !== newLink) {
|
||||
// Fallback: URL changed due to redirect
|
||||
newLink = newLinkRes2.url.split("?link=")[1] || newLinkRes2.url;
|
||||
} else {
|
||||
newLink =
|
||||
newLinkRes2.headers.get("location")?.split("?link=")[1] ||
|
||||
newLink;
|
||||
}
|
||||
}
|
||||
|
||||
streamLinks.push({
|
||||
server: "hubcloud",
|
||||
link: newLink,
|
||||
type: "mkv",
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("hubcloudExtractor error in hubcloud link: ", error);
|
||||
}
|
||||
break;
|
||||
|
||||
case link?.includes("cloudflarestorage"):
|
||||
streamLinks.push({ server: "CfStorage", link: link, type: "mkv" });
|
||||
break;
|
||||
|
||||
case link?.includes("fastdl") || link?.includes("fsl."):
|
||||
streamLinks.push({ server: "FastDl", link: link, type: "mkv" });
|
||||
break;
|
||||
|
||||
case link.includes("hubcdn") && !link.includes("/?id="):
|
||||
streamLinks.push({
|
||||
server: "HubCdn",
|
||||
link: link,
|
||||
type: "mkv",
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
if (link?.includes(".mkv") || link?.includes("?token=")) {
|
||||
const serverName =
|
||||
link
|
||||
.match(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/i)?.[1]
|
||||
?.replace(/\./g, " ") || "Unknown";
|
||||
streamLinks.push({ server: serverName, link: link, type: "mkv" });
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("streamLinks", streamLinks);
|
||||
return streamLinks;
|
||||
} catch (error: any) {
|
||||
console.log("hubcloudExtractor error: ", error?.message || error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
export async function superVideoExtractor(data: any) {
|
||||
try {
|
||||
// Step 1: Extract the function parameters and the encoded string
|
||||
var functionRegex =
|
||||
/eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/;
|
||||
var match = functionRegex.exec(data);
|
||||
let p = "";
|
||||
if (match) {
|
||||
// var params = match[1].split(',').map(param => param.trim());
|
||||
var encodedString = match[2];
|
||||
|
||||
// console.log('Parameters:', params);
|
||||
// console.log('Encoded String:', encodedString.split("',36,")[0], '🔥🔥');
|
||||
|
||||
p = encodedString.split("',36,")?.[0].trim();
|
||||
let a = 36;
|
||||
let c = encodedString.split("',36,")[1].slice(2).split("|").length;
|
||||
let k = encodedString.split("',36,")[1].slice(2).split("|");
|
||||
|
||||
while (c--) {
|
||||
if (k[c]) {
|
||||
var regex = new RegExp("\\b" + c.toString(a) + "\\b", "g");
|
||||
p = p.replace(regex, k[c]);
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('Decoded String:', p);
|
||||
} else {
|
||||
console.log("No match found");
|
||||
}
|
||||
|
||||
const streamUrl = p?.match(/file:\s*"([^"]+\.m3u8[^"]*)"/)?.[1];
|
||||
console.log("streamUrl:", streamUrl);
|
||||
|
||||
return streamUrl || "";
|
||||
} catch (err) {
|
||||
console.error("SuperVideoExtractor Error:", err);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user