mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
feat: add extractors bundled in file refactor stream handling in multiple providers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ProviderContext, Stream } from "../types";
|
||||
import { hubcloudExtractor } from "../extractors/hubcloud";
|
||||
|
||||
const headers = {
|
||||
Accept:
|
||||
@@ -31,8 +32,7 @@ export async function getStream({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}) {
|
||||
const { axios, cheerio, extractors } = providerContext;
|
||||
const { hubcloudExtracter } = extractors;
|
||||
const { axios, cheerio, commonHeaders } = providerContext;
|
||||
try {
|
||||
const streamLinks: Stream[] = [];
|
||||
console.log("dotlink", link);
|
||||
@@ -49,7 +49,7 @@ export async function getStream({
|
||||
try {
|
||||
const $ = cheerio.load(dotlinkText);
|
||||
const filepressLink = $(
|
||||
'.btn.btn-sm.btn-outline[style="background:linear-gradient(135deg,rgb(252,185,0) 0%,rgb(0,0,0)); color: #fdf8f2;"]'
|
||||
'.btn.btn-sm.btn-outline[style="background:linear-gradient(135deg,rgb(252,185,0) 0%,rgb(0,0,0)); color: #fdf8f2;"]',
|
||||
)
|
||||
.parent()
|
||||
.attr("href");
|
||||
@@ -73,7 +73,7 @@ export async function getStream({
|
||||
"Content-Type": "application/json",
|
||||
Referer: filepressBaseUrl,
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
// console.log('filepressTokenRes', filepressTokenRes.data);
|
||||
if (filepressTokenRes.data?.status) {
|
||||
@@ -90,7 +90,7 @@ export async function getStream({
|
||||
"Content-Type": "application/json",
|
||||
Referer: filepressBaseUrl,
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
// console.log('filepressStreamLink', filepressStreamLink.data);
|
||||
streamLinks.push({
|
||||
@@ -105,7 +105,7 @@ export async function getStream({
|
||||
}
|
||||
}
|
||||
|
||||
return await hubcloudExtracter(link, signal);
|
||||
return await hubcloudExtractor(link, signal, axios, cheerio, commonHeaders);
|
||||
} catch (error: any) {
|
||||
console.log("getStream error: ", error);
|
||||
if (error.message.includes("Aborted")) {
|
||||
|
||||
Reference in New Issue
Block a user