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:
68
dist/vadapav/vadapavGetInfo.js
vendored
Normal file
68
dist/vadapav/vadapavGetInfo.js
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.vadapavGetInfo = void 0;
|
||||
const vadapavGetInfo = async function ({ link, providerContext, }) {
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const baseUrl = link?.split('/').slice(0, 3).join('/');
|
||||
const url = link;
|
||||
const res = await axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const title = $('.directory')
|
||||
.children()
|
||||
.first()
|
||||
.text()
|
||||
.trim()
|
||||
?.split('/')
|
||||
.pop()
|
||||
?.trim() || '';
|
||||
const links = [];
|
||||
$('.directory-entry:not(:contains("Parent Directory"))').map((i, element) => {
|
||||
const link = $(element).attr('href');
|
||||
if (link) {
|
||||
links.push({
|
||||
episodesLink: baseUrl + link,
|
||||
title: $(element).text(),
|
||||
});
|
||||
}
|
||||
});
|
||||
const directLinks = [];
|
||||
$('.file-entry:not(:contains("Parent Directory"))').map((i, element) => {
|
||||
const link = $(element).attr('href');
|
||||
if (link &&
|
||||
($(element).text()?.includes('.mp4') ||
|
||||
$(element).text()?.includes('.mkv'))) {
|
||||
directLinks.push({
|
||||
title: i + 1 + '. ' + $(element).text(),
|
||||
link: baseUrl + link,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (directLinks.length > 0) {
|
||||
links.push({
|
||||
title: title + ' DL',
|
||||
directLinks: directLinks,
|
||||
});
|
||||
}
|
||||
return {
|
||||
title: title,
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
linkList: links,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.vadapavGetInfo = vadapavGetInfo;
|
||||
Reference in New Issue
Block a user