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:
54
dist/hiAnime/HiGetSteam.js
vendored
Normal file
54
dist/hiAnime/HiGetSteam.js
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hiGetStream = void 0;
|
||||
const types_1 = require("../types");
|
||||
const hiGetStream = async function ({ link: id, providerContext, }) {
|
||||
try {
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
const servers = ['vidcloud', 'vidstreaming'];
|
||||
const url = `${baseUrl}/anime/zoro/watch?episodeId=${id}&server=`;
|
||||
const streamLinks = [];
|
||||
await Promise.all(servers.map(async (server) => {
|
||||
try {
|
||||
const res = await axios.get(url + server);
|
||||
if (res.data) {
|
||||
const subtitles = [];
|
||||
res.data?.subtitles.forEach((sub) => {
|
||||
if (sub?.lang === 'Thumbnails')
|
||||
return;
|
||||
subtitles.push({
|
||||
language: sub?.lang?.slice(0, 2) || 'Und',
|
||||
uri: sub?.url,
|
||||
title: sub?.lang || 'Undefined',
|
||||
type: sub?.url?.endsWith('.vtt')
|
||||
? types_1.TextTrackType.VTT
|
||||
: types_1.TextTrackType.SUBRIP,
|
||||
});
|
||||
});
|
||||
res.data?.sources.forEach((source) => {
|
||||
streamLinks.push({
|
||||
server: server,
|
||||
link: source?.url,
|
||||
type: source?.isM3U8 ? 'm3u8' : 'mp4',
|
||||
headers: {
|
||||
Referer: 'https://megacloud.club/',
|
||||
Origin: 'https://megacloud.club',
|
||||
},
|
||||
subtitles: subtitles,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}));
|
||||
return streamLinks;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
exports.hiGetStream = hiGetStream;
|
||||
22
dist/hiAnime/hiCatalog.js
vendored
Normal file
22
dist/hiAnime/hiCatalog.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hiGenresList = exports.hiCatalog = void 0;
|
||||
exports.hiCatalog = [
|
||||
{
|
||||
title: 'Recent',
|
||||
filter: '/anime/zoro/recent-episodes',
|
||||
},
|
||||
{
|
||||
title: 'Top Airing',
|
||||
filter: '/anime/zoro/top-airing',
|
||||
},
|
||||
{
|
||||
title: 'Most Popular',
|
||||
filter: '/anime/zoro/most-popular',
|
||||
},
|
||||
{
|
||||
title: 'Most Favorited',
|
||||
filter: '/anime/zoro/most-favorite',
|
||||
},
|
||||
];
|
||||
exports.hiGenresList = [];
|
||||
78
dist/hiAnime/hiGetInfo.js
vendored
Normal file
78
dist/hiAnime/hiGetInfo.js
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hiGetInfo = void 0;
|
||||
const hiGetInfo = async function ({ link, providerContext, }) {
|
||||
try {
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
const url = `${baseUrl}/anime/zoro/info?id=` + link;
|
||||
const res = await axios.get(url);
|
||||
const data = res.data;
|
||||
const meta = {
|
||||
title: data.title,
|
||||
synopsis: data.description,
|
||||
image: data.image,
|
||||
tags: [
|
||||
data?.type,
|
||||
data?.subOrDub === 'both' ? 'Sub And Dub' : data?.subOrDub,
|
||||
],
|
||||
imdbId: '',
|
||||
type: data.episodes.length > 0 ? 'series' : 'movie',
|
||||
};
|
||||
const linkList = [];
|
||||
const subLinks = [];
|
||||
data.episodes.forEach((episode) => {
|
||||
if (!episode?.isSubbed) {
|
||||
return;
|
||||
}
|
||||
const title = 'Episode ' + episode.number + (episode?.isFiller ? ' (Filler)' : '');
|
||||
const link = episode.id + '$sub';
|
||||
if (link && title) {
|
||||
subLinks.push({
|
||||
title,
|
||||
link,
|
||||
});
|
||||
}
|
||||
});
|
||||
linkList.push({
|
||||
title: meta.title + ' (Sub)',
|
||||
directLinks: subLinks,
|
||||
});
|
||||
if (data?.subOrDub === 'both') {
|
||||
const dubLinks = [];
|
||||
data.episodes.forEach((episode) => {
|
||||
if (!episode?.isDubbed) {
|
||||
return;
|
||||
}
|
||||
const title = 'Episode ' + episode.number + (episode?.isFiller ? ' (Filler)' : '');
|
||||
const link = episode.id + '$dub';
|
||||
if (link && title) {
|
||||
dubLinks.push({
|
||||
title,
|
||||
link,
|
||||
});
|
||||
}
|
||||
});
|
||||
linkList.push({
|
||||
title: meta.title + ' (Dub)',
|
||||
directLinks: dubLinks,
|
||||
});
|
||||
}
|
||||
return {
|
||||
...meta,
|
||||
linkList: linkList,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.hiGetInfo = hiGetInfo;
|
||||
41
dist/hiAnime/hiGetPosts.js
vendored
Normal file
41
dist/hiAnime/hiGetPosts.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hiGetPostsSearch = exports.hiGetPosts = void 0;
|
||||
const hiGetPosts = async function ({ filter, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
const url = `${baseUrl + filter}?page=${page}`;
|
||||
return posts({ url, signal, axios });
|
||||
};
|
||||
exports.hiGetPosts = hiGetPosts;
|
||||
const hiGetPostsSearch = async function ({ searchQuery, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
const url = `${baseUrl}/anime/zoro/${searchQuery}?page=${page}`;
|
||||
return posts({ url, signal, axios });
|
||||
};
|
||||
exports.hiGetPostsSearch = hiGetPostsSearch;
|
||||
async function posts({ url, signal, axios, }) {
|
||||
try {
|
||||
const res = await axios.get(url, { signal });
|
||||
const data = res.data?.results;
|
||||
const catalog = [];
|
||||
data?.map((element) => {
|
||||
const title = element.title;
|
||||
const link = element.id;
|
||||
const image = element.image;
|
||||
if (title && link && image) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
}
|
||||
catch (err) {
|
||||
console.error('zoro error ', err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
15
dist/hiAnime/index.js
vendored
Normal file
15
dist/hiAnime/index.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HiAnime = void 0;
|
||||
const hiGetInfo_1 = require("./hiGetInfo");
|
||||
const hiCatalog_1 = require("./hiCatalog");
|
||||
const HiGetSteam_1 = require("./HiGetSteam");
|
||||
const hiGetPosts_1 = require("./hiGetPosts");
|
||||
exports.HiAnime = {
|
||||
catalog: hiCatalog_1.hiCatalog,
|
||||
genres: hiCatalog_1.hiGenresList,
|
||||
GetMetaData: hiGetInfo_1.hiGetInfo,
|
||||
GetHomePosts: hiGetPosts_1.hiGetPosts,
|
||||
GetStream: HiGetSteam_1.hiGetStream,
|
||||
GetSearchPosts: hiGetPosts_1.hiGetPostsSearch,
|
||||
};
|
||||
Reference in New Issue
Block a user