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:
50
dist/kissKh/kissKhGetInfo.js
vendored
Normal file
50
dist/kissKh/kissKhGetInfo.js
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.kissKhGetInfo = void 0;
|
||||
const kissKhGetInfo = async function ({ link, providerContext, }) {
|
||||
try {
|
||||
const { axios } = providerContext;
|
||||
const res = await axios.get(link);
|
||||
const data = res.data;
|
||||
const meta = {
|
||||
title: data.title,
|
||||
synopsis: data.description,
|
||||
image: data.thumbnail,
|
||||
tags: [data?.releaseDate?.split('-')[0], data?.status, data?.type],
|
||||
imdbId: '',
|
||||
type: data.episodesCount > 1 ? 'series' : 'movie',
|
||||
};
|
||||
const linkList = [];
|
||||
const subLinks = [];
|
||||
data?.episodes?.reverse().map((episode) => {
|
||||
const title = 'Episode ' + episode?.number;
|
||||
const link = episode?.id?.toString();
|
||||
if (link && title) {
|
||||
subLinks.push({
|
||||
title,
|
||||
link,
|
||||
});
|
||||
}
|
||||
});
|
||||
linkList.push({
|
||||
title: meta.title,
|
||||
directLinks: subLinks,
|
||||
});
|
||||
return {
|
||||
...meta,
|
||||
linkList: linkList,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.kissKhGetInfo = kissKhGetInfo;
|
||||
Reference in New Issue
Block a user