mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { Stream, ProviderContext } from "../types";
|
|
|
|
export const getStream = async function ({
|
|
link: id,
|
|
// type,
|
|
signal,
|
|
providerContext,
|
|
}: {
|
|
link: string;
|
|
type: string;
|
|
signal: AbortSignal;
|
|
providerContext: ProviderContext;
|
|
}): Promise<Stream[]> {
|
|
try {
|
|
const { axios, cheerio } = providerContext;
|
|
const stream: Stream[] = [];
|
|
const [, epId] = id.split("&");
|
|
const url = `https://feb.8man.workers.dev/?fid=${epId}`;
|
|
const res = await axios.get(url, { signal });
|
|
const data = res.data;
|
|
const $ = cheerio.load(data.html);
|
|
$(".file_quality").each((i, el) => {
|
|
const server =
|
|
$(el).find("p.name").text() +
|
|
" - " +
|
|
$(el).find("p.size").text() +
|
|
" - " +
|
|
$(el).find("p.speed").text();
|
|
const link = $(el).attr("data-url");
|
|
if (link) {
|
|
stream.push({
|
|
server: server,
|
|
type: "mkv",
|
|
link: link,
|
|
});
|
|
}
|
|
});
|
|
console.log(stream);
|
|
return stream;
|
|
} catch (err) {
|
|
return [];
|
|
}
|
|
};
|