mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
31 lines
979 B
JavaScript
31 lines
979 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getStream = void 0;
|
|
const getStream = async function ({ link, providerContext, }) {
|
|
try {
|
|
const { cheerio } = providerContext;
|
|
const url = link;
|
|
const res = await fetch(url);
|
|
const data = await res.text();
|
|
const $ = cheerio.load(data);
|
|
const streamLinks = [];
|
|
$(".c_h1,.c_h2").map((i, element) => {
|
|
$(element).find("span").remove();
|
|
const title = $(element).find("a").text() || "";
|
|
const link = $(element).find("a").attr("href") || "";
|
|
if (title && link.includes("media")) {
|
|
streamLinks.push({
|
|
server: title,
|
|
link,
|
|
type: link.split(".").pop() || "mkv",
|
|
});
|
|
}
|
|
});
|
|
return streamLinks;
|
|
}
|
|
catch (err) {
|
|
return [];
|
|
}
|
|
};
|
|
exports.getStream = getStream;
|