mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-18 08:01:43 +00:00
Co-authored-by: shaker <your_github_username@users.noreply.github.com> Co-authored-by: himanshu8443 <sangwanhimanshu8443@gmail.com>
35 lines
832 B
TypeScript
35 lines
832 B
TypeScript
import { ProviderContext, Stream } from "../types";
|
|
|
|
export async function getStream({
|
|
link,
|
|
signal,
|
|
providerContext,
|
|
}: {
|
|
link: string;
|
|
type: string;
|
|
signal: AbortSignal;
|
|
providerContext: ProviderContext;
|
|
}) {
|
|
const { axios, cheerio, commonHeaders: headers } = providerContext;
|
|
const res = await axios.get(link, { headers, signal });
|
|
const html = res.data;
|
|
const $ = cheerio.load(html);
|
|
const Streams: Stream[] = [];
|
|
|
|
// Find the actual .mp4 download link
|
|
let downloadLink = null;
|
|
$('a:contains("Fast Download Server")').each((i, el) => {
|
|
const href = $(el).attr("href");
|
|
if (href && href.toLocaleLowerCase().includes(".mp4")) {
|
|
Streams.push({
|
|
link: href,
|
|
type: "mp4",
|
|
server: "Fast Download",
|
|
headers: headers,
|
|
});
|
|
}
|
|
});
|
|
|
|
return Streams;
|
|
}
|