mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-06-02 21:48:14 +00:00
fix multiple providers
This commit is contained in:
@@ -74,8 +74,18 @@ export const getEpisodes = async function ({
|
||||
}
|
||||
});
|
||||
}
|
||||
if (episodeLinks.length === 0) {
|
||||
// https://hubcloud.foo/drive/gvdzmpioeeaf8mp
|
||||
// find link contain hubcloud and have drive in url using regex
|
||||
const hubcloudLink = html.match(
|
||||
/https:\/\/hubcloud\.[^\/]+\/drive\/[^"'\s]+/i,
|
||||
)?.[0];
|
||||
if (hubcloudLink) {
|
||||
episodeLinks.push({ title: "Play", link: hubcloudLink });
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(episodeLinks);
|
||||
console.log("episodeLinks:", episodeLinks);
|
||||
return episodeLinks.length > 0
|
||||
? episodeLinks
|
||||
: [{ title: "Play", link: url }];
|
||||
|
||||
@@ -56,7 +56,6 @@ async function posts({
|
||||
const title = $(element).find(".poster-title").text();
|
||||
const link = $(element).parent().attr("href");
|
||||
const image = $(element).find(".poster-image img").attr("src");
|
||||
console.log({ title, link, image });
|
||||
if (title && link && image) {
|
||||
catalog.push({
|
||||
title: title.replace("Download", "").trim(),
|
||||
|
||||
@@ -5,6 +5,28 @@ const hubcloudDecode = function (value: string) {
|
||||
return atob(value.toString());
|
||||
};
|
||||
|
||||
const getPixelDrainUrl = (html: string) => {
|
||||
const match = html.match(/var\s+pxl\s*=\s*['"]([^'"]+)['"];?/i);
|
||||
return match?.[1] || "";
|
||||
};
|
||||
|
||||
const getRedirectedPixelDrainUrl = (
|
||||
...htmlSources: Array<string | undefined>
|
||||
) => {
|
||||
for (const html of htmlSources) {
|
||||
if (!html) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const redirectedUrl = getPixelDrainUrl(html);
|
||||
if (redirectedUrl) {
|
||||
return redirectedUrl;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
export async function hubcloudExtractor(
|
||||
link: string,
|
||||
signal: AbortSignal,
|
||||
@@ -16,7 +38,7 @@ export async function hubcloudExtractor(
|
||||
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);
|
||||
// console.log("headers", headers);
|
||||
const baseUrl = link.split("/").slice(0, 3).join("/");
|
||||
const streamLinks: any[] = [];
|
||||
const vLinkRes = await axios(`${link}`, { headers, signal });
|
||||
@@ -38,7 +60,8 @@ export async function hubcloudExtractor(
|
||||
signal,
|
||||
redirect: "follow",
|
||||
});
|
||||
const $ = cheerio.load(await vcloudRes.text());
|
||||
const vcloudText = await vcloudRes.text();
|
||||
const $ = cheerio.load(vcloudText);
|
||||
// console.log('vcloudRes', $.text());
|
||||
|
||||
const linkClass = $(".btn-success.btn-lg.h6,.btn-danger,.btn-secondary");
|
||||
@@ -48,8 +71,21 @@ export async function hubcloudExtractor(
|
||||
|
||||
switch (true) {
|
||||
case link?.includes("pixeld"):
|
||||
console.log("Pixeldrain link found:", link);
|
||||
if (!link?.includes("api")) {
|
||||
const token = link.split("/").pop();
|
||||
const redirectedPixelDrainUrl = getRedirectedPixelDrainUrl(
|
||||
vLinkText,
|
||||
vcloudText,
|
||||
);
|
||||
if (redirectedPixelDrainUrl) {
|
||||
console.log(
|
||||
"Special case for token negn6f",
|
||||
redirectedPixelDrainUrl,
|
||||
);
|
||||
link = redirectedPixelDrainUrl;
|
||||
}
|
||||
|
||||
const token = link.split("/").pop()?.split("?")[0];
|
||||
const baseUrl = link.split("/").slice(0, -2).join("/");
|
||||
link = `${baseUrl}/api/file/${token}`;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,11 @@ const headers = {
|
||||
"sec-ch-ua-platform": '"Windows"',
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
Cookie: "popads_user_id=6ba8fe60a481387a3249f05aa058822d",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0",
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0",
|
||||
};
|
||||
|
||||
export const getPosts = async function ({
|
||||
@@ -60,7 +59,7 @@ export const getSearchPosts = async function ({
|
||||
async function posts(
|
||||
url: string,
|
||||
signal: AbortSignal,
|
||||
providerContext: ProviderContext
|
||||
providerContext: ProviderContext,
|
||||
): Promise<Post[]> {
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
|
||||
Reference in New Issue
Block a user