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:
@@ -14,8 +14,6 @@ export const getEpisodes = async function ({
|
||||
let $ = cheerio.load(html);
|
||||
|
||||
const episodeLinks: EpisodeLink[] = [];
|
||||
|
||||
// Try old format first (backward compatibility)
|
||||
$('a:contains("HubCloud")').map((i, element) => {
|
||||
const title = $(element).parent().prev().text();
|
||||
const link = $(element).attr("href");
|
||||
@@ -27,58 +25,8 @@ export const getEpisodes = async function ({
|
||||
}
|
||||
});
|
||||
|
||||
// If old format didn't work, try new format
|
||||
if (episodeLinks.length === 0) {
|
||||
// Find all anchor tags with href containing streaming services
|
||||
const streamingServices = ["hubcloud", "gdflix"];
|
||||
let currentTitle = "";
|
||||
|
||||
$('h5 span[style*="color"], h5').each((i, element) => {
|
||||
const text = $(element).text().trim();
|
||||
// Look for titles that contain quality indicators or episode info
|
||||
if (
|
||||
text &&
|
||||
(text.match(/\d{3,4}p/) ||
|
||||
text.includes("Ep") ||
|
||||
text.includes("Episode"))
|
||||
) {
|
||||
currentTitle = text;
|
||||
|
||||
// Find the next links after this title
|
||||
let nextElement = $(element).parent();
|
||||
for (let j = 0; j < 10; j++) {
|
||||
nextElement = nextElement.next();
|
||||
if (!nextElement.length) break;
|
||||
|
||||
const links = nextElement.find("a[href]");
|
||||
links.each((k, linkEl) => {
|
||||
const href = $(linkEl).attr("href");
|
||||
if (
|
||||
href &&
|
||||
streamingServices.some((service) => href.includes(service))
|
||||
) {
|
||||
// Determine server name from URL
|
||||
let serverName = "Play";
|
||||
if (href.includes("hubcloud")) serverName = "HubCloud";
|
||||
else if (href.includes("gdflix")) serverName = "GDFlix";
|
||||
else if (href.includes("pixeldrain")) serverName = "Pixeldrain";
|
||||
else if (href.includes("fastdl")) serverName = "FastDL";
|
||||
|
||||
const title = currentTitle
|
||||
? `${currentTitle} - ${serverName}`
|
||||
: serverName;
|
||||
episodeLinks.push({ title, link: href });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// console.log(episodeLinks);
|
||||
return episodeLinks.length > 0
|
||||
? episodeLinks
|
||||
: [{ title: "Play", link: url }];
|
||||
return episodeLinks;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Stream, ProviderContext } from "../types";
|
||||
import { hubcloudExtractor } from "../extractors/hubcloud";
|
||||
import { gdflixExtractor } from "../extractors/gdflix";
|
||||
|
||||
export const getStream = async function ({
|
||||
link: url,
|
||||
@@ -13,61 +11,37 @@ export const getStream = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
const { axios, cheerio, commonHeaders: headers } = providerContext;
|
||||
const headers = providerContext.commonHeaders;
|
||||
try {
|
||||
if (type === "movie") {
|
||||
const res = await axios.get(url, { headers });
|
||||
const res = await providerContext.axios.get(url, { headers });
|
||||
const html = res.data;
|
||||
const $ = cheerio.load(html);
|
||||
const $ = providerContext.cheerio.load(html);
|
||||
const link = $('a:contains("HubCloud")').attr("href");
|
||||
url = link || url;
|
||||
}
|
||||
|
||||
let redirectUrl = "";
|
||||
try {
|
||||
const res = await axios.get(url, { headers });
|
||||
const res = await providerContext.axios.get(url, { headers });
|
||||
let redirectUrl = res.data.match(
|
||||
/<meta\s+http-equiv="refresh"\s+content="[^"]*?;\s*url=([^"]+)"\s*\/?>/i
|
||||
)?.[1];
|
||||
if (url.includes("/archives/")) {
|
||||
redirectUrl = res.data.match(
|
||||
/<meta\s+http-equiv="refresh"\s+content="[^"]*?;\s*url=([^"]+)"\s*\/?>/i,
|
||||
/<a\s+[^>]*href="(https:\/\/hubcloud\.[^\/]+\/[^"]+)"/i
|
||||
)?.[1];
|
||||
if (url.includes("/archives/")) {
|
||||
redirectUrl = res.data.match(
|
||||
/<a\s+[^>]*href="(https:\/\/hubcloud\.[^\/]+\/[^"]+)"/i,
|
||||
)?.[1];
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error("Hubcloud redirect err", err?.message || err);
|
||||
}
|
||||
if (!redirectUrl) {
|
||||
if (url.includes("hubcloud")) {
|
||||
console.log(" hubcloud link found in:", url);
|
||||
return await hubcloudExtractor(url, signal, axios, cheerio, headers);
|
||||
} else if (url.includes("gdflix")) {
|
||||
// handle gdflix links
|
||||
console.log("gdflix link found:", url);
|
||||
const gdflixStreams = await gdflixExtractor(
|
||||
url,
|
||||
signal,
|
||||
axios,
|
||||
cheerio,
|
||||
headers,
|
||||
);
|
||||
return gdflixStreams;
|
||||
}
|
||||
return await providerContext.extractors.hubcloudExtracter(url, signal);
|
||||
}
|
||||
console.log("redirectUrl", redirectUrl);
|
||||
const res2 = await axios.get(redirectUrl, { headers });
|
||||
const res2 = await providerContext.axios.get(redirectUrl, { headers });
|
||||
const data = res2.data;
|
||||
const $ = cheerio.load(data);
|
||||
const $ = providerContext.cheerio.load(data);
|
||||
const hubcloudLink = $(".fa-file-download").parent().attr("href");
|
||||
return await hubcloudExtractor(
|
||||
return await providerContext.extractors.hubcloudExtracter(
|
||||
hubcloudLink?.includes("https://hubcloud") ? hubcloudLink : redirectUrl,
|
||||
signal,
|
||||
axios,
|
||||
cheerio,
|
||||
headers,
|
||||
signal
|
||||
);
|
||||
} catch (err: any) {
|
||||
console.error("Movies Drive err", err?.message || err);
|
||||
} catch (err) {
|
||||
console.error("Movies Drive err", err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user