mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
init
This commit is contained in:
17
dist/katmovies/index.js
vendored
Normal file
17
dist/katmovies/index.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.katMoviesHd = void 0;
|
||||
const katCatalog_1 = require("./katCatalog");
|
||||
const katGetEpsodes_1 = require("./katGetEpsodes");
|
||||
const katGetInfo_1 = require("./katGetInfo");
|
||||
const katGetPosts_1 = require("./katGetPosts");
|
||||
const katGetSteam_1 = require("./katGetSteam");
|
||||
exports.katMoviesHd = {
|
||||
catalog: katCatalog_1.katCatalog,
|
||||
genres: katCatalog_1.katGenresList,
|
||||
GetMetaData: katGetInfo_1.katGetInfo,
|
||||
GetHomePosts: katGetPosts_1.katGetPosts,
|
||||
GetStream: katGetSteam_1.katGetStream,
|
||||
GetEpisodeLinks: katGetEpsodes_1.katEpisodeLinks,
|
||||
GetSearchPosts: katGetPosts_1.katGetPostsSearch,
|
||||
};
|
||||
63
dist/katmovies/katCatalog.js
vendored
Normal file
63
dist/katmovies/katCatalog.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/katGetEpsodes.js
vendored
Normal file
70
dist/katmovies/katGetEpsodes.js
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.katEpisodeLinks = void 0;
|
||||
exports.extractKmhdLink = extractKmhdLink;
|
||||
const katEpisodeLinks = 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.katEpisodeLinks = katEpisodeLinks;
|
||||
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/katGetInfo.js
vendored
Normal file
115
dist/katmovies/katGetInfo.js
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.katGetInfo = void 0;
|
||||
const katGetInfo = 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.katGetInfo = katGetInfo;
|
||||
44
dist/katmovies/katGetPosts.js
vendored
Normal file
44
dist/katmovies/katGetPosts.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.katGetPostsSearch = exports.katGetPosts = void 0;
|
||||
const katGetPosts = 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.katGetPosts = katGetPosts;
|
||||
const katGetPostsSearch = 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.katGetPostsSearch = katGetPostsSearch;
|
||||
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 [];
|
||||
}
|
||||
}
|
||||
90
dist/katmovies/katGetSteam.js
vendored
Normal file
90
dist/katmovies/katGetSteam.js
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.katGetStream = katGetStream;
|
||||
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 katGetStream({ 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 [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user