mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
init
This commit is contained in:
20
providers/cinemaLuxe/clCatalog.ts
Normal file
20
providers/cinemaLuxe/clCatalog.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export const clCatalog = [
|
||||
{
|
||||
title: 'Trending',
|
||||
filter: '/genre/latest-trending-releases/',
|
||||
},
|
||||
{
|
||||
title: 'Netflix',
|
||||
filter: '/network/netflix/',
|
||||
},
|
||||
{
|
||||
title: 'Amazon Prime',
|
||||
filter: '/network/prime-video/',
|
||||
},
|
||||
{
|
||||
title: 'Animation',
|
||||
filter: '/genre/anime/',
|
||||
},
|
||||
];
|
||||
|
||||
export const clGenresList = [];
|
||||
73
providers/cinemaLuxe/clGetEpisodes.ts
Normal file
73
providers/cinemaLuxe/clGetEpisodes.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import {EpisodeLink, ProviderContext} from '../types';
|
||||
|
||||
export const clsEpisodeLinks = async function ({
|
||||
url,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<EpisodeLink[]> {
|
||||
try {
|
||||
if (!url.includes('luxelinks') || url.includes('luxecinema')) {
|
||||
const res = await providerContext.axios.get(url, {
|
||||
headers: providerContext.commonHeaders,
|
||||
});
|
||||
const data = res.data;
|
||||
const encodedLink = data.match(/"link":"([^"]+)"/)?.[1];
|
||||
if (encodedLink) {
|
||||
url = encodedLink ? atob(encodedLink) : url;
|
||||
} else {
|
||||
const redirectUrlRes = await fetch(
|
||||
'https://ext.8man.me/api/cinemaluxe',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({url}),
|
||||
},
|
||||
);
|
||||
const redirectUrl = await redirectUrlRes.json();
|
||||
url = redirectUrl?.redirectUrl || url;
|
||||
}
|
||||
}
|
||||
const res = await providerContext.axios.get(url, {
|
||||
headers: providerContext.commonHeaders,
|
||||
});
|
||||
const html = res.data;
|
||||
let $ = providerContext.cheerio.load(html);
|
||||
const episodeLinks: EpisodeLink[] = [];
|
||||
if (url.includes('luxedrive')) {
|
||||
episodeLinks.push({
|
||||
title: 'Movie',
|
||||
link: url,
|
||||
});
|
||||
return episodeLinks;
|
||||
}
|
||||
$('a.maxbutton-4,a.maxbutton,.maxbutton-hubcloud,.ep-simple-button').map(
|
||||
(i, element) => {
|
||||
const title = $(element).text()?.trim();
|
||||
const link = $(element).attr('href');
|
||||
if (
|
||||
title &&
|
||||
link &&
|
||||
!title.includes('Batch') &&
|
||||
!title.toLowerCase().includes('zip')
|
||||
) {
|
||||
episodeLinks.push({
|
||||
title: title
|
||||
.replace(/\(\d{4}\)/, '')
|
||||
.replace('Download', 'Movie')
|
||||
.replace('⚡', '')
|
||||
.trim(),
|
||||
link,
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
return episodeLinks;
|
||||
} catch (err) {
|
||||
console.error('cl episode links', err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
69
providers/cinemaLuxe/clGetMeta.ts
Normal file
69
providers/cinemaLuxe/clGetMeta.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import {Info, Link, ProviderContext} from '../types';
|
||||
|
||||
export const clGetInfo = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const url = link;
|
||||
const res = await providerContext.axios.get(url, {
|
||||
headers: providerContext.commonHeaders,
|
||||
});
|
||||
const data = res.data;
|
||||
const $ = providerContext.cheerio.load(data);
|
||||
const type = url.includes('tvshows') ? 'series' : 'movie';
|
||||
const imdbId = '';
|
||||
const title = url.split('/')[4].replace(/-/g, ' ');
|
||||
const image = $('.g-item').find('a').attr('href') || '';
|
||||
const synopsis = $('.wp-content').text().trim();
|
||||
const tags = $('.sgeneros')
|
||||
.children()
|
||||
.map((i, element) => $(element).text())
|
||||
.get()
|
||||
.slice(3);
|
||||
const rating = Number($('#repimdb').find('strong').text())
|
||||
.toFixed(1)
|
||||
.toString();
|
||||
const links: Link[] = [];
|
||||
$('.mb-center.maxbutton-5-center,.ep-button-container').map(
|
||||
(i, element) => {
|
||||
const title = $(element)
|
||||
.text()
|
||||
.replace('\u2b07Download', '')
|
||||
.replace('\u2b07 Download', '')
|
||||
.trim();
|
||||
const link = $(element).find('a').attr('href');
|
||||
if (title && link) {
|
||||
links.push({
|
||||
title,
|
||||
episodesLink: link,
|
||||
quality: title?.match(/\d+P\b/)?.[0].replace('P', 'p') || '',
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
return {
|
||||
title,
|
||||
tags,
|
||||
rating,
|
||||
synopsis,
|
||||
image,
|
||||
imdbId,
|
||||
type,
|
||||
linkList: links,
|
||||
};
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
82
providers/cinemaLuxe/clGetPosts.ts
Normal file
82
providers/cinemaLuxe/clGetPosts.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import {Post, ProviderContext} from '../types';
|
||||
|
||||
export const clGetPosts = async function ({
|
||||
filter,
|
||||
page,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
filter: string;
|
||||
page: number;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const baseUrl = await providerContext.getBaseUrl('cinemaLuxe');
|
||||
const url = `${baseUrl + filter}page/${page}/`;
|
||||
return posts({url, signal, providerContext});
|
||||
};
|
||||
|
||||
export const clGetPostsSearch = async function ({
|
||||
searchQuery,
|
||||
page,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
searchQuery: string;
|
||||
page: number;
|
||||
providerValue: string;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const baseUrl = await providerContext.getBaseUrl('cinemaLuxe');
|
||||
const url = `${baseUrl}/page/${page}/?s=${searchQuery}`;
|
||||
return posts({url, signal, providerContext});
|
||||
};
|
||||
|
||||
async function posts({
|
||||
url,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
headers: providerContext.commonHeaders,
|
||||
signal,
|
||||
});
|
||||
const data = await res.text();
|
||||
const $ = providerContext.cheerio.load(data);
|
||||
const catalog: Post[] = [];
|
||||
$('.item.tvshows,.item.movies').map((i, element) => {
|
||||
const title = $(element).find('.poster').find('img').attr('alt');
|
||||
const link = $(element).find('.poster').find('a').attr('href');
|
||||
const image = $(element).find('.poster').find('img').attr('data-src');
|
||||
if (title && link && image) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
$('.result-item').map((i, element) => {
|
||||
const title = $(element).find('.thumbnail').find('img').attr('alt');
|
||||
const link = $(element).find('.thumbnail').find('a').attr('href');
|
||||
const image = $(element).find('.thumbnail').find('img').attr('data-src');
|
||||
if (title && link && image) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
console.error('cinemaluxe error ', err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
47
providers/cinemaLuxe/clGetSteam.ts
Normal file
47
providers/cinemaLuxe/clGetSteam.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import {Stream, ProviderContext} from '../types';
|
||||
|
||||
export const clGetStream = async ({
|
||||
link,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
type: string;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> => {
|
||||
try {
|
||||
let newLink = link;
|
||||
if (link.includes('luxedrive')) {
|
||||
const res = await providerContext.axios.get(link);
|
||||
const $ = providerContext.cheerio.load(res.data);
|
||||
const hubcloudLink = $('a.btn.hubcloud').attr('href');
|
||||
if (hubcloudLink) {
|
||||
newLink = hubcloudLink;
|
||||
} else {
|
||||
const gdFlixLink = $('a.btn.gdflix').attr('href');
|
||||
if (gdFlixLink) {
|
||||
newLink = gdFlixLink;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newLink.includes('gdflix')) {
|
||||
const sreams = await providerContext.extractors.gdFlixExtracter(
|
||||
newLink,
|
||||
signal,
|
||||
);
|
||||
return sreams;
|
||||
}
|
||||
const res2 = await providerContext.axios.get(newLink, {signal});
|
||||
const data2 = res2.data;
|
||||
const hcLink = data2.match(/location\.replace\('([^']+)'/)?.[1] || newLink;
|
||||
const hubCloudLinks = await providerContext.extractors.hubcloudExtracter(
|
||||
hcLink.includes('https://hubcloud') ? hcLink : newLink,
|
||||
signal,
|
||||
);
|
||||
return hubCloudLinks;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
16
providers/cinemaLuxe/index.ts
Normal file
16
providers/cinemaLuxe/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import {clGenresList, clCatalog} from './clCatalog';
|
||||
import {clGetInfo} from './clGetMeta';
|
||||
import {clsEpisodeLinks} from './clGetEpisodes';
|
||||
import {clGetPostsSearch, clGetPosts} from './clGetPosts';
|
||||
import {ProviderType} from '../types';
|
||||
import {clGetStream} from './clGetSteam';
|
||||
|
||||
export const cinemaLuxe: ProviderType = {
|
||||
catalog: clCatalog,
|
||||
genres: clGenresList,
|
||||
GetHomePosts: clGetPosts,
|
||||
GetMetaData: clGetInfo,
|
||||
GetSearchPosts: clGetPostsSearch,
|
||||
GetEpisodeLinks: clsEpisodeLinks,
|
||||
GetStream: clGetStream,
|
||||
};
|
||||
Reference in New Issue
Block a user