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:
30
dist/vadapav/vadapavGetEpisodes.js
vendored
Normal file
30
dist/vadapav/vadapavGetEpisodes.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.vadapavGetEpisodeLinks = void 0;
|
||||
const vadapavGetEpisodeLinks = async function ({ url, providerContext, }) {
|
||||
const { axios, cheerio } = providerContext;
|
||||
try {
|
||||
const baseUrl = url?.split('/').slice(0, 3).join('/');
|
||||
const res = await axios.get(url);
|
||||
const html = res.data;
|
||||
let $ = cheerio.load(html);
|
||||
const episodeLinks = [];
|
||||
$('.file-entry:not(:contains("Parent Directory"))').map((i, element) => {
|
||||
const link = $(element).attr('href');
|
||||
if (link &&
|
||||
($(element).text()?.includes('.mp4') ||
|
||||
$(element).text()?.includes('.mkv'))) {
|
||||
episodeLinks.push({
|
||||
title: $(element).text()?.match(/E\d+/)?.[0]?.replace('E', 'Episode ') ||
|
||||
i + 1 + '. ' + $(element).text()?.replace('.mkv', ''),
|
||||
link: baseUrl + link,
|
||||
});
|
||||
}
|
||||
});
|
||||
return episodeLinks;
|
||||
}
|
||||
catch (err) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
exports.vadapavGetEpisodeLinks = vadapavGetEpisodeLinks;
|
||||
Reference in New Issue
Block a user