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,5 +1,4 @@
|
||||
import { ProviderContext } from "../types";
|
||||
import { hubcloudExtractor } from "../extractors/hubcloud";
|
||||
|
||||
export async function getStream({
|
||||
link,
|
||||
@@ -11,7 +10,13 @@ export async function getStream({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}) {
|
||||
const { axios, cheerio, commonHeaders: headers } = providerContext;
|
||||
const {
|
||||
axios,
|
||||
cheerio,
|
||||
extractors,
|
||||
commonHeaders: headers,
|
||||
} = providerContext;
|
||||
const { hubcloudExtracter } = extractors;
|
||||
let hubdriveLink = "";
|
||||
if (link.includes("hubdrive")) {
|
||||
const hubdriveRes = await axios.get(link, { headers, signal });
|
||||
@@ -28,13 +33,7 @@ export async function getStream({
|
||||
const redirectLink = await getRedirectLinks(link, signal, headers);
|
||||
console.log("redirectLink", redirectLink);
|
||||
if (redirectLink.includes("hubcloud") || redirectLink.includes("/drive/")) {
|
||||
return await hubcloudExtractor(
|
||||
redirectLink,
|
||||
signal,
|
||||
axios,
|
||||
cheerio,
|
||||
headers,
|
||||
);
|
||||
return await hubcloudExtracter(redirectLink, signal);
|
||||
}
|
||||
const redirectLinkRes = await axios.get(redirectLink, { headers, signal });
|
||||
const redirectLinkText = redirectLinkRes.data;
|
||||
@@ -60,13 +59,7 @@ export async function getStream({
|
||||
/<META HTTP-EQUIV="refresh" content="0; url=([^"]+)">/i,
|
||||
)?.[1] || hubdriveLink;
|
||||
try {
|
||||
return await hubcloudExtractor(
|
||||
hubcloudLink,
|
||||
signal,
|
||||
axios,
|
||||
cheerio,
|
||||
headers,
|
||||
);
|
||||
return await hubcloudExtracter(hubcloudLink, signal);
|
||||
} catch (error: any) {
|
||||
console.log("hd hub 4 getStream error: ", error);
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user