mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
65 lines
2.3 KiB
JavaScript
65 lines
2.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.clsEpisodeLinks = void 0;
|
|
const clsEpisodeLinks = async function ({ url, providerContext, }) {
|
|
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 = [];
|
|
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 [];
|
|
}
|
|
};
|
|
exports.clsEpisodeLinks = clsEpisodeLinks;
|