mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
renaming
This commit is contained in:
@@ -1,53 +1,53 @@
|
||||
import {EpisodeLink, ProviderContext} from '../types';
|
||||
import { EpisodeLink, ProviderContext } from "../types";
|
||||
|
||||
export const katEpisodeLinks = async function ({
|
||||
export const getEpisodes = async function ({
|
||||
url,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<EpisodeLink[]> {
|
||||
const {axios, cheerio} = providerContext;
|
||||
const { axios, cheerio } = providerContext;
|
||||
const episodesLink: EpisodeLink[] = [];
|
||||
try {
|
||||
if (url.includes('gdflix')) {
|
||||
const baseUrl = url.split('/pack')?.[0];
|
||||
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');
|
||||
const links = $(".list-group-item");
|
||||
links?.map((i, link) => {
|
||||
episodesLink.push({
|
||||
title: $(link).text() || '',
|
||||
link: baseUrl + $(link).find('a').attr('href') || '',
|
||||
title: $(link).text() || "",
|
||||
link: baseUrl + $(link).find("a").attr("href") || "",
|
||||
});
|
||||
});
|
||||
if (episodesLink.length > 0) {
|
||||
return episodesLink;
|
||||
}
|
||||
}
|
||||
if (url.includes('/pack')) {
|
||||
if (url.includes("/pack")) {
|
||||
const epIds = await extractKmhdEpisodes(url, providerContext);
|
||||
epIds?.forEach((id: string, index: number) => {
|
||||
episodesLink.push({
|
||||
title: `Episode ${index + 1}`,
|
||||
link: url.split('/pack')[0] + '/file/' + id,
|
||||
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',
|
||||
"_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');
|
||||
const links = $(".autohyperlink");
|
||||
links?.map((i, link) => {
|
||||
episodesLink.push({
|
||||
title: $(link).parent().children().remove().end().text() || '',
|
||||
link: $(link).attr('href') || '',
|
||||
title: $(link).parent().children().remove().end().text() || "",
|
||||
link: $(link).attr("href") || "",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -60,23 +60,23 @@ export const katEpisodeLinks = async function ({
|
||||
|
||||
export async function extractKmhdLink(
|
||||
katlink: string,
|
||||
providerContext: ProviderContext,
|
||||
providerContext: ProviderContext
|
||||
) {
|
||||
const {axios} = 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*"([^"]+)"/,
|
||||
/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/
|
||||
)[1];
|
||||
return hubDriveLink + hubDriveRes;
|
||||
}
|
||||
|
||||
async function extractKmhdEpisodes(
|
||||
katlink: string,
|
||||
providerContext: ProviderContext,
|
||||
providerContext: ProviderContext
|
||||
) {
|
||||
const {axios} = providerContext;
|
||||
const { axios } = providerContext;
|
||||
const res = await axios.get(katlink);
|
||||
const data = res.data;
|
||||
const ids = data.match(/[\w]+_[a-f0-9]{8}/g);
|
||||
@@ -1,16 +0,0 @@
|
||||
import {katCatalog, katGenresList} from './katCatalog';
|
||||
import {katEpisodeLinks} from './katGetEpsodes';
|
||||
import {katGetInfo} from './katGetInfo';
|
||||
import {katGetPosts, katGetPostsSearch} from './katGetPosts';
|
||||
import {katGetStream} from './katGetSteam';
|
||||
import {ProviderType} from '../types';
|
||||
|
||||
export const katMoviesHd: ProviderType = {
|
||||
catalog: katCatalog,
|
||||
genres: katGenresList,
|
||||
GetMetaData: katGetInfo,
|
||||
GetHomePosts: katGetPosts,
|
||||
GetStream: katGetStream,
|
||||
GetEpisodeLinks: katEpisodeLinks,
|
||||
GetSearchPosts: katGetPostsSearch,
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Info, Link, ProviderContext} from '../types';
|
||||
import { Info, Link, ProviderContext } from "../types";
|
||||
|
||||
export const katGetInfo = async function ({
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
@@ -8,49 +8,49 @@ export const katGetInfo = async function ({
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const {axios, cheerio} = providerContext;
|
||||
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 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] || '';
|
||||
.attr("href")
|
||||
?.split("/")[4] || "";
|
||||
const title = container
|
||||
.find('li:contains("Name")')
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text();
|
||||
const type = $('.yQ8hqd.ksSzJd.LoQAYe').html() ? 'series' : 'movie';
|
||||
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') || '';
|
||||
$('h4:contains("SCREENSHOTS")').next().find("img").attr("src") || "";
|
||||
|
||||
console.log('katGetInfo', title, synopsis, image, imdbId, type);
|
||||
console.log("katGetInfo", title, synopsis, image, imdbId, type);
|
||||
|
||||
// Links
|
||||
const links: Link[] = [];
|
||||
const directLink: Link['directLinks'] = [];
|
||||
const directLink: Link["directLinks"] = [];
|
||||
|
||||
// direct links
|
||||
$('.entry-content')
|
||||
$(".entry-content")
|
||||
.find('p:contains("Episode")')
|
||||
.each((i, element) => {
|
||||
const dlLink =
|
||||
$(element)
|
||||
.nextAll('h3,h2')
|
||||
.nextAll("h3,h2")
|
||||
.first()
|
||||
.find('a:contains("1080"),a:contains("720"),a:contains("480")')
|
||||
.attr('href') || '';
|
||||
const dlTitle = $(element).find('span').text();
|
||||
.attr("href") || "";
|
||||
const dlTitle = $(element).find("span").text();
|
||||
|
||||
if (link.trim().length > 0 && dlTitle.includes('Episode ')) {
|
||||
if (link.trim().length > 0 && dlTitle.includes("Episode ")) {
|
||||
directLink.push({
|
||||
title: dlTitle,
|
||||
link: dlLink,
|
||||
@@ -60,24 +60,24 @@ export const katGetInfo = async function ({
|
||||
|
||||
if (directLink.length > 0) {
|
||||
links.push({
|
||||
quality: '',
|
||||
quality: "",
|
||||
title: title,
|
||||
directLinks: directLink,
|
||||
});
|
||||
}
|
||||
|
||||
$('.entry-content')
|
||||
.find('pre')
|
||||
.nextUntil('div')
|
||||
.filter('h2')
|
||||
$(".entry-content")
|
||||
.find("pre")
|
||||
.nextUntil("div")
|
||||
.filter("h2")
|
||||
.each((i, element) => {
|
||||
const link = $(element).find('a').attr('href');
|
||||
const link = $(element).find("a").attr("href");
|
||||
const quality =
|
||||
$(element)
|
||||
.text()
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || '';
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || "";
|
||||
const title = $(element).text();
|
||||
if (link && title.includes('')) {
|
||||
if (link && title.includes("")) {
|
||||
links.push({
|
||||
quality,
|
||||
title,
|
||||
@@ -86,23 +86,23 @@ export const katGetInfo = async function ({
|
||||
}
|
||||
});
|
||||
|
||||
if (links.length === 0 && type === 'movie') {
|
||||
$('.entry-content')
|
||||
if (links.length === 0 && type === "movie") {
|
||||
$(".entry-content")
|
||||
.find('h2:contains("DOWNLOAD"),h3:contains("DOWNLOAD")')
|
||||
.nextUntil('pre,div')
|
||||
.filter('h2')
|
||||
.nextUntil("pre,div")
|
||||
.filter("h2")
|
||||
.each((i, element) => {
|
||||
const link = $(element).find('a').attr('href');
|
||||
const link = $(element).find("a").attr("href");
|
||||
const quality =
|
||||
$(element)
|
||||
.text()
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || '';
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || "";
|
||||
const title = $(element).text();
|
||||
if (link && !title.includes('Online')) {
|
||||
if (link && !title.includes("Online")) {
|
||||
links.push({
|
||||
quality,
|
||||
title,
|
||||
directLinks: [{link, title, type: 'movie'}],
|
||||
directLinks: [{ link, title, type: "movie" }],
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -120,11 +120,11 @@ export const katGetInfo = async function ({
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Post, ProviderContext} from '../types';
|
||||
import { Post, ProviderContext } from "../types";
|
||||
|
||||
export const katGetPosts = async function ({
|
||||
export const getPosts = async function ({
|
||||
filter,
|
||||
page,
|
||||
signal,
|
||||
@@ -12,13 +12,13 @@ export const katGetPosts = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, cheerio} = providerContext;
|
||||
const baseUrl = await getBaseUrl('kat');
|
||||
const { getBaseUrl, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl("kat");
|
||||
const url = `${baseUrl + filter}/page/${page}/`;
|
||||
return posts({url, signal, cheerio});
|
||||
return posts({ url, signal, cheerio });
|
||||
};
|
||||
|
||||
export const katGetPostsSearch = async function ({
|
||||
export const getSearchPosts = async function ({
|
||||
searchQuery,
|
||||
page,
|
||||
signal,
|
||||
@@ -30,10 +30,10 @@ export const katGetPostsSearch = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, cheerio} = providerContext;
|
||||
const baseUrl = await getBaseUrl('kat');
|
||||
const { getBaseUrl, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl("kat");
|
||||
const url = `${baseUrl}/page/${page}/?s=${searchQuery}`;
|
||||
return posts({url, signal, cheerio});
|
||||
return posts({ url, signal, cheerio });
|
||||
};
|
||||
|
||||
async function posts({
|
||||
@@ -43,22 +43,22 @@ async function posts({
|
||||
}: {
|
||||
url: string;
|
||||
signal: AbortSignal;
|
||||
cheerio: ProviderContext['cheerio'];
|
||||
cheerio: ProviderContext["cheerio"];
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const res = await fetch(url, {signal});
|
||||
const res = await fetch(url, { signal });
|
||||
const data = await res.text();
|
||||
const $ = cheerio.load(data);
|
||||
const catalog: Post[] = [];
|
||||
$('.recent-posts')
|
||||
$(".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');
|
||||
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(),
|
||||
title: title.replace("Download", "").trim(),
|
||||
link: link,
|
||||
image: image,
|
||||
});
|
||||
@@ -66,7 +66,7 @@ async function posts({
|
||||
});
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
console.error('katmovies error ', err);
|
||||
console.error("katmovies error ", err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
import {Stream, ProviderContext} from '../types';
|
||||
import { Stream, ProviderContext } from "../types";
|
||||
|
||||
async function extractKmhdLink(
|
||||
katlink: string,
|
||||
providerContext: ProviderContext,
|
||||
providerContext: ProviderContext
|
||||
) {
|
||||
const {axios} = 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*"([^"]+)"/,
|
||||
/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/
|
||||
)[1];
|
||||
return hubDriveLink + hubDriveRes;
|
||||
}
|
||||
export async function katGetStream({
|
||||
export const getStream = async function ({
|
||||
link,
|
||||
signal,
|
||||
providerContext,
|
||||
@@ -23,77 +23,77 @@ export async function katGetStream({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
const {axios, cheerio, extractors} = providerContext;
|
||||
const {hubcloudExtracter, gdFlixExtracter} = extractors;
|
||||
const { axios, cheerio, extractors } = providerContext;
|
||||
const { hubcloudExtracter, gdFlixExtracter } = extractors;
|
||||
const streamLinks: Stream[] = [];
|
||||
console.log('katGetStream', link);
|
||||
console.log("katGetStream", link);
|
||||
try {
|
||||
if (link.includes('gdflix')) {
|
||||
if (link.includes("gdflix")) {
|
||||
return await gdFlixExtracter(link, signal);
|
||||
}
|
||||
if (link.includes('kmhd')) {
|
||||
if (link.includes("kmhd")) {
|
||||
const hubcloudLink = await extractKmhdLink(link, providerContext);
|
||||
return await hubcloudExtracter(hubcloudLink, signal);
|
||||
}
|
||||
if (link.includes('gdflix')) {
|
||||
if (link.includes("gdflix")) {
|
||||
// resume link
|
||||
try {
|
||||
const resumeDrive = link.replace('/file', '/zfile');
|
||||
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);
|
||||
const resumeLink = $resumeDrive(".btn-success").attr("href");
|
||||
console.log("resumeLink", resumeLink);
|
||||
if (resumeLink) {
|
||||
streamLinks.push({
|
||||
server: 'ResumeCloud',
|
||||
server: "ResumeCloud",
|
||||
link: resumeLink,
|
||||
type: 'mkv',
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Resume link not found');
|
||||
console.log("Resume link not found");
|
||||
}
|
||||
//instant link
|
||||
try {
|
||||
const driveres = await axios.get(link, {timeout: 10000});
|
||||
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];
|
||||
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';
|
||||
InstantFromData.append("keys", instantToken);
|
||||
const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api";
|
||||
// console.log('videoSeedUrl', videoSeedUrl);
|
||||
const instantLinkRes = await fetch(videoSeedUrl, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
body: InstantFromData,
|
||||
headers: {
|
||||
'x-token': videoSeedUrl,
|
||||
"x-token": videoSeedUrl,
|
||||
},
|
||||
});
|
||||
const instantLinkData = await instantLinkRes.json();
|
||||
console.log('instantLinkData', instantLinkData);
|
||||
console.log("instantLinkData", instantLinkData);
|
||||
if (instantLinkData.error === false) {
|
||||
const instantLink = instantLinkData.url;
|
||||
streamLinks.push({
|
||||
server: 'Gdrive-Instant',
|
||||
server: "Gdrive-Instant",
|
||||
link: instantLink,
|
||||
type: 'mkv',
|
||||
type: "mkv",
|
||||
});
|
||||
} else {
|
||||
console.log('Instant link not found', instantLinkData);
|
||||
console.log("Instant link not found", instantLinkData);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Instant link not found', err);
|
||||
console.log("Instant link not found", err);
|
||||
}
|
||||
return streamLinks;
|
||||
}
|
||||
const stereams = await hubcloudExtracter(link, signal);
|
||||
return stereams;
|
||||
} catch (error: any) {
|
||||
console.log('katgetStream error: ', error);
|
||||
console.log("katgetStream error: ", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user