mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
build
This commit is contained in:
63
dist/katmovies/catalog.js
vendored
Normal file
63
dist/katmovies/catalog.js
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.katGenresList = exports.katCatalog = void 0;
|
||||
exports.katCatalog = [
|
||||
{
|
||||
title: 'Latest',
|
||||
filter: '',
|
||||
},
|
||||
{
|
||||
title: 'Netflix',
|
||||
filter: '/category/netflix',
|
||||
},
|
||||
{
|
||||
title: 'Animated',
|
||||
filter: '/category/animated',
|
||||
},
|
||||
{
|
||||
title: 'Amazon Prime',
|
||||
filter: '/category/amazon-prime',
|
||||
},
|
||||
];
|
||||
exports.katGenresList = [
|
||||
{
|
||||
title: 'Action',
|
||||
filter: '/category/action',
|
||||
},
|
||||
{
|
||||
title: 'Crime',
|
||||
filter: '/category/crime',
|
||||
},
|
||||
{
|
||||
title: 'Comedy',
|
||||
filter: '/category/comedy',
|
||||
},
|
||||
{
|
||||
title: 'Drama',
|
||||
filter: '/category/drama',
|
||||
},
|
||||
{
|
||||
title: 'Horror',
|
||||
filter: '/category/horror',
|
||||
},
|
||||
{
|
||||
title: 'Family',
|
||||
filter: '/category/family',
|
||||
},
|
||||
{
|
||||
title: 'Sci-Fi',
|
||||
filter: '/category/sifi',
|
||||
},
|
||||
{
|
||||
title: 'Thriller',
|
||||
filter: '/category/triller',
|
||||
},
|
||||
{
|
||||
title: 'Romance',
|
||||
filter: '/category/romance',
|
||||
},
|
||||
{
|
||||
title: 'Fight',
|
||||
filter: '/category/fight',
|
||||
},
|
||||
];
|
||||
70
dist/katmovies/episodes.js
vendored
Normal file
70
dist/katmovies/episodes.js
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEpisodes = void 0;
|
||||
exports.extractKmhdLink = extractKmhdLink;
|
||||
const getEpisodes = async function ({ url, providerContext, }) {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const episodesLink = [];
|
||||
try {
|
||||
if (url.includes("gdflix")) {
|
||||
const baseUrl = url.split("/pack")?.[0];
|
||||
const res = await axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const links = $(".list-group-item");
|
||||
links?.map((i, link) => {
|
||||
episodesLink.push({
|
||||
title: $(link).text() || "",
|
||||
link: baseUrl + $(link).find("a").attr("href") || "",
|
||||
});
|
||||
});
|
||||
if (episodesLink.length > 0) {
|
||||
return episodesLink;
|
||||
}
|
||||
}
|
||||
if (url.includes("/pack")) {
|
||||
const epIds = await extractKmhdEpisodes(url, providerContext);
|
||||
epIds?.forEach((id, index) => {
|
||||
episodesLink.push({
|
||||
title: `Episode ${index + 1}`,
|
||||
link: url.split("/pack")[0] + "/file/" + id,
|
||||
});
|
||||
});
|
||||
}
|
||||
const res = await axios.get(url, {
|
||||
headers: {
|
||||
Cookie: "_ga_GNR438JY8N=GS1.1.1722240350.5.0.1722240350.0.0.0; _ga=GA1.1.372196696.1722150754; unlocked=true",
|
||||
},
|
||||
});
|
||||
const episodeData = res.data;
|
||||
const $ = cheerio.load(episodeData);
|
||||
const links = $(".autohyperlink");
|
||||
links?.map((i, link) => {
|
||||
episodesLink.push({
|
||||
title: $(link).parent().children().remove().end().text() || "",
|
||||
link: $(link).attr("href") || "",
|
||||
});
|
||||
});
|
||||
return episodesLink;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
exports.getEpisodes = getEpisodes;
|
||||
async function extractKmhdLink(katlink, providerContext) {
|
||||
const { axios } = providerContext;
|
||||
const res = await axios.get(katlink);
|
||||
const data = res.data;
|
||||
const hubDriveRes = data.match(/hubdrive_res:\s*"([^"]+)"/)[1];
|
||||
const hubDriveLink = data.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1];
|
||||
return hubDriveLink + hubDriveRes;
|
||||
}
|
||||
async function extractKmhdEpisodes(katlink, providerContext) {
|
||||
const { axios } = providerContext;
|
||||
const res = await axios.get(katlink);
|
||||
const data = res.data;
|
||||
const ids = data.match(/[\w]+_[a-f0-9]{8}/g);
|
||||
return ids;
|
||||
}
|
||||
115
dist/katmovies/meta.js
vendored
Normal file
115
dist/katmovies/meta.js
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getMeta = void 0;
|
||||
const getMeta = async function ({ link, providerContext, }) {
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
const res = await axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const container = $(".yQ8hqd.ksSzJd.LoQAYe").html()
|
||||
? $(".yQ8hqd.ksSzJd.LoQAYe")
|
||||
: $(".FxvUNb");
|
||||
const imdbId = container
|
||||
.find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])')
|
||||
.attr("href")
|
||||
?.split("/")[4] || "";
|
||||
const title = container
|
||||
.find('li:contains("Name")')
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text();
|
||||
const type = $(".yQ8hqd.ksSzJd.LoQAYe").html() ? "series" : "movie";
|
||||
const synopsis = container.find('li:contains("Stars")').text();
|
||||
const image = $('h4:contains("SCREENSHOTS")').next().find("img").attr("src") || "";
|
||||
console.log("katGetInfo", title, synopsis, image, imdbId, type);
|
||||
// Links
|
||||
const links = [];
|
||||
const directLink = [];
|
||||
// direct links
|
||||
$(".entry-content")
|
||||
.find('p:contains("Episode")')
|
||||
.each((i, element) => {
|
||||
const dlLink = $(element)
|
||||
.nextAll("h3,h2")
|
||||
.first()
|
||||
.find('a:contains("1080"),a:contains("720"),a:contains("480")')
|
||||
.attr("href") || "";
|
||||
const dlTitle = $(element).find("span").text();
|
||||
if (link.trim().length > 0 && dlTitle.includes("Episode ")) {
|
||||
directLink.push({
|
||||
title: dlTitle,
|
||||
link: dlLink,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (directLink.length > 0) {
|
||||
links.push({
|
||||
quality: "",
|
||||
title: title,
|
||||
directLinks: directLink,
|
||||
});
|
||||
}
|
||||
$(".entry-content")
|
||||
.find("pre")
|
||||
.nextUntil("div")
|
||||
.filter("h2")
|
||||
.each((i, element) => {
|
||||
const link = $(element).find("a").attr("href");
|
||||
const quality = $(element)
|
||||
.text()
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || "";
|
||||
const title = $(element).text();
|
||||
if (link && title.includes("")) {
|
||||
links.push({
|
||||
quality,
|
||||
title,
|
||||
episodesLink: link,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (links.length === 0 && type === "movie") {
|
||||
$(".entry-content")
|
||||
.find('h2:contains("DOWNLOAD"),h3:contains("DOWNLOAD")')
|
||||
.nextUntil("pre,div")
|
||||
.filter("h2")
|
||||
.each((i, element) => {
|
||||
const link = $(element).find("a").attr("href");
|
||||
const quality = $(element)
|
||||
.text()
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || "";
|
||||
const title = $(element).text();
|
||||
if (link && !title.includes("Online")) {
|
||||
links.push({
|
||||
quality,
|
||||
title,
|
||||
directLinks: [{ link, title, type: "movie" }],
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// console.log('drive meta', title, synopsis, image, imdbId, type, links);
|
||||
return {
|
||||
title,
|
||||
synopsis,
|
||||
image,
|
||||
imdbId,
|
||||
type,
|
||||
linkList: links,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.getMeta = getMeta;
|
||||
44
dist/katmovies/posts.js
vendored
Normal file
44
dist/katmovies/posts.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSearchPosts = exports.getPosts = void 0;
|
||||
const getPosts = async function ({ filter, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl("kat");
|
||||
const url = `${baseUrl + filter}/page/${page}/`;
|
||||
return posts({ url, signal, cheerio });
|
||||
};
|
||||
exports.getPosts = getPosts;
|
||||
const getSearchPosts = async function ({ searchQuery, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl("kat");
|
||||
const url = `${baseUrl}/page/${page}/?s=${searchQuery}`;
|
||||
return posts({ url, signal, cheerio });
|
||||
};
|
||||
exports.getSearchPosts = getSearchPosts;
|
||||
async function posts({ url, signal, cheerio, }) {
|
||||
try {
|
||||
const res = await fetch(url, { signal });
|
||||
const data = await res.text();
|
||||
const $ = cheerio.load(data);
|
||||
const catalog = [];
|
||||
$(".recent-posts")
|
||||
.children()
|
||||
.map((i, element) => {
|
||||
const title = $(element).find("img").attr("alt");
|
||||
const link = $(element).find("a").attr("href");
|
||||
const image = $(element).find("img").attr("src");
|
||||
if (title && link && image) {
|
||||
catalog.push({
|
||||
title: title.replace("Download", "").trim(),
|
||||
link: link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
}
|
||||
catch (err) {
|
||||
console.error("katmovies error ", err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
91
dist/katmovies/stream.js
vendored
Normal file
91
dist/katmovies/stream.js
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getStream = void 0;
|
||||
async function extractKmhdLink(katlink, providerContext) {
|
||||
const { axios } = providerContext;
|
||||
const res = await axios.get(katlink);
|
||||
const data = res.data;
|
||||
const hubDriveRes = data.match(/hubdrive_res:\s*"([^"]+)"/)[1];
|
||||
const hubDriveLink = data.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1];
|
||||
return hubDriveLink + hubDriveRes;
|
||||
}
|
||||
const getStream = async function ({ link, signal, providerContext, }) {
|
||||
const { axios, cheerio, extractors } = providerContext;
|
||||
const { hubcloudExtracter, gdFlixExtracter } = extractors;
|
||||
const streamLinks = [];
|
||||
console.log("katGetStream", link);
|
||||
try {
|
||||
if (link.includes("gdflix")) {
|
||||
return await gdFlixExtracter(link, signal);
|
||||
}
|
||||
if (link.includes("kmhd")) {
|
||||
const hubcloudLink = await extractKmhdLink(link, providerContext);
|
||||
return await hubcloudExtracter(hubcloudLink, signal);
|
||||
}
|
||||
if (link.includes("gdflix")) {
|
||||
// resume link
|
||||
try {
|
||||
const resumeDrive = link.replace("/file", "/zfile");
|
||||
// console.log('resumeDrive', resumeDrive);
|
||||
const resumeDriveRes = await axios.get(resumeDrive);
|
||||
const resumeDriveHtml = resumeDriveRes.data;
|
||||
const $resumeDrive = cheerio.load(resumeDriveHtml);
|
||||
const resumeLink = $resumeDrive(".btn-success").attr("href");
|
||||
console.log("resumeLink", resumeLink);
|
||||
if (resumeLink) {
|
||||
streamLinks.push({
|
||||
server: "ResumeCloud",
|
||||
link: resumeLink,
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Resume link not found");
|
||||
}
|
||||
//instant link
|
||||
try {
|
||||
const driveres = await axios.get(link, { timeout: 10000 });
|
||||
const $drive = cheerio.load(driveres.data);
|
||||
const seed = $drive(".btn-danger").attr("href") || "";
|
||||
const instantToken = seed.split("=")[1];
|
||||
// console.log('InstantToken', instantToken);
|
||||
const InstantFromData = new FormData();
|
||||
InstantFromData.append("keys", instantToken);
|
||||
const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api";
|
||||
// console.log('videoSeedUrl', videoSeedUrl);
|
||||
const instantLinkRes = await fetch(videoSeedUrl, {
|
||||
method: "POST",
|
||||
body: InstantFromData,
|
||||
headers: {
|
||||
"x-token": videoSeedUrl,
|
||||
},
|
||||
});
|
||||
const instantLinkData = await instantLinkRes.json();
|
||||
console.log("instantLinkData", instantLinkData);
|
||||
if (instantLinkData.error === false) {
|
||||
const instantLink = instantLinkData.url;
|
||||
streamLinks.push({
|
||||
server: "Gdrive-Instant",
|
||||
link: instantLink,
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log("Instant link not found", instantLinkData);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Instant link not found", err);
|
||||
}
|
||||
return streamLinks;
|
||||
}
|
||||
const stereams = await hubcloudExtracter(link, signal);
|
||||
return stereams;
|
||||
}
|
||||
catch (error) {
|
||||
console.log("katgetStream error: ", error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
exports.getStream = getStream;
|
||||
Reference in New Issue
Block a user