mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
renaming
This commit is contained in:
20
providers/hiAnime/catalog.ts
Normal file
20
providers/hiAnime/catalog.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export const catalogs = [
|
||||
{
|
||||
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",
|
||||
},
|
||||
];
|
||||
|
||||
export const genres = [];
|
||||
@@ -1,20 +0,0 @@
|
||||
export const 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',
|
||||
},
|
||||
];
|
||||
|
||||
export const hiGenresList = [];
|
||||
@@ -1,14 +0,0 @@
|
||||
import {hiGetInfo} from './hiGetInfo';
|
||||
import {hiCatalog, hiGenresList} from './hiCatalog';
|
||||
import {hiGetStream} from './HiGetSteam';
|
||||
import {hiGetPosts, hiGetPostsSearch} from './hiGetPosts';
|
||||
import {ProviderType} from '../types';
|
||||
|
||||
export const HiAnime: ProviderType = {
|
||||
catalog: hiCatalog,
|
||||
genres: hiGenresList,
|
||||
GetMetaData: hiGetInfo,
|
||||
GetHomePosts: hiGetPosts,
|
||||
GetStream: hiGetStream,
|
||||
GetSearchPosts: hiGetPostsSearch,
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Info, Link, ProviderContext} from '../types';
|
||||
import { Info, Link, ProviderContext } from "../types";
|
||||
|
||||
export const hiGetInfo = async function ({
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
@@ -8,8 +8,8 @@ export const hiGetInfo = async function ({
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const {getBaseUrl, axios} = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
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;
|
||||
@@ -19,20 +19,20 @@ export const hiGetInfo = async function ({
|
||||
image: data.image,
|
||||
tags: [
|
||||
data?.type,
|
||||
data?.subOrDub === 'both' ? 'Sub And Dub' : data?.subOrDub,
|
||||
data?.subOrDub === "both" ? "Sub And Dub" : data?.subOrDub,
|
||||
],
|
||||
imdbId: '',
|
||||
type: data.episodes.length > 0 ? 'series' : 'movie',
|
||||
imdbId: "",
|
||||
type: data.episodes.length > 0 ? "series" : "movie",
|
||||
};
|
||||
const linkList: Link[] = [];
|
||||
const subLinks: Link['directLinks'] = [];
|
||||
const subLinks: Link["directLinks"] = [];
|
||||
data.episodes.forEach((episode: any) => {
|
||||
if (!episode?.isSubbed) {
|
||||
return;
|
||||
}
|
||||
const title =
|
||||
'Episode ' + episode.number + (episode?.isFiller ? ' (Filler)' : '');
|
||||
const link = episode.id + '$sub';
|
||||
"Episode " + episode.number + (episode?.isFiller ? " (Filler)" : "");
|
||||
const link = episode.id + "$sub";
|
||||
if (link && title) {
|
||||
subLinks.push({
|
||||
title,
|
||||
@@ -41,18 +41,18 @@ export const hiGetInfo = async function ({
|
||||
}
|
||||
});
|
||||
linkList.push({
|
||||
title: meta.title + ' (Sub)',
|
||||
title: meta.title + " (Sub)",
|
||||
directLinks: subLinks,
|
||||
});
|
||||
if (data?.subOrDub === 'both') {
|
||||
const dubLinks: Link['directLinks'] = [];
|
||||
if (data?.subOrDub === "both") {
|
||||
const dubLinks: Link["directLinks"] = [];
|
||||
data.episodes.forEach((episode: any) => {
|
||||
if (!episode?.isDubbed) {
|
||||
return;
|
||||
}
|
||||
const title =
|
||||
'Episode ' + episode.number + (episode?.isFiller ? ' (Filler)' : '');
|
||||
const link = episode.id + '$dub';
|
||||
"Episode " + episode.number + (episode?.isFiller ? " (Filler)" : "");
|
||||
const link = episode.id + "$dub";
|
||||
if (link && title) {
|
||||
dubLinks.push({
|
||||
title,
|
||||
@@ -61,7 +61,7 @@ export const hiGetInfo = async function ({
|
||||
}
|
||||
});
|
||||
linkList.push({
|
||||
title: meta.title + ' (Dub)',
|
||||
title: meta.title + " (Dub)",
|
||||
directLinks: dubLinks,
|
||||
});
|
||||
}
|
||||
@@ -72,11 +72,11 @@ export const hiGetInfo = async function ({
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Post, ProviderContext} from '../types';
|
||||
import { Post, ProviderContext } from "../types";
|
||||
|
||||
export const hiGetPosts = async function ({
|
||||
export const getPosts = async function ({
|
||||
filter,
|
||||
page,
|
||||
signal,
|
||||
@@ -12,13 +12,13 @@ export const hiGetPosts = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, axios} = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = await getBaseUrl("consumet");
|
||||
const url = `${baseUrl + filter}?page=${page}`;
|
||||
return posts({url, signal, axios});
|
||||
return posts({ url, signal, axios });
|
||||
};
|
||||
|
||||
export const hiGetPostsSearch = async function ({
|
||||
export const getSearchPosts = async function ({
|
||||
searchQuery,
|
||||
page,
|
||||
signal,
|
||||
@@ -30,10 +30,10 @@ export const hiGetPostsSearch = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, axios} = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = await getBaseUrl("consumet");
|
||||
const url = `${baseUrl}/anime/zoro/${searchQuery}?page=${page}`;
|
||||
return posts({url, signal, axios});
|
||||
return posts({ url, signal, axios });
|
||||
};
|
||||
|
||||
async function posts({
|
||||
@@ -43,10 +43,10 @@ async function posts({
|
||||
}: {
|
||||
url: string;
|
||||
signal: AbortSignal;
|
||||
axios: ProviderContext['axios'];
|
||||
axios: ProviderContext["axios"];
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const res = await axios.get(url, {signal});
|
||||
const res = await axios.get(url, { signal });
|
||||
const data = res.data?.results;
|
||||
const catalog: Post[] = [];
|
||||
data?.map((element: any) => {
|
||||
@@ -63,7 +63,7 @@ async function posts({
|
||||
});
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
console.error('zoro error ', err);
|
||||
console.error("zoro error ", err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Stream, ProviderContext, TextTracks, TextTrackType} from '../types';
|
||||
import { Stream, ProviderContext, TextTracks, TextTrackType } from "../types";
|
||||
|
||||
export const hiGetStream = async function ({
|
||||
export const getStream = async function ({
|
||||
link: id,
|
||||
providerContext,
|
||||
}: {
|
||||
@@ -8,24 +8,24 @@ export const hiGetStream = async function ({
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
try {
|
||||
const {getBaseUrl, axios} = providerContext;
|
||||
const baseUrl = await getBaseUrl('consumet');
|
||||
const servers = ['vidcloud', 'vidstreaming'];
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const baseUrl = await getBaseUrl("consumet");
|
||||
const servers = ["vidcloud", "vidstreaming"];
|
||||
const url = `${baseUrl}/anime/zoro/watch?episodeId=${id}&server=`;
|
||||
const streamLinks: Stream[] = [];
|
||||
await Promise.all(
|
||||
servers.map(async server => {
|
||||
servers.map(async (server) => {
|
||||
try {
|
||||
const res = await axios.get(url + server);
|
||||
if (res.data) {
|
||||
const subtitles: TextTracks = [];
|
||||
res.data?.subtitles.forEach((sub: any) => {
|
||||
if (sub?.lang === 'Thumbnails') return;
|
||||
if (sub?.lang === "Thumbnails") return;
|
||||
subtitles.push({
|
||||
language: sub?.lang?.slice(0, 2) || 'Und',
|
||||
language: sub?.lang?.slice(0, 2) || "Und",
|
||||
uri: sub?.url,
|
||||
title: sub?.lang || 'Undefined',
|
||||
type: sub?.url?.endsWith('.vtt')
|
||||
title: sub?.lang || "Undefined",
|
||||
type: sub?.url?.endsWith(".vtt")
|
||||
? TextTrackType.VTT
|
||||
: TextTrackType.SUBRIP,
|
||||
});
|
||||
@@ -34,10 +34,10 @@ export const hiGetStream = async function ({
|
||||
streamLinks.push({
|
||||
server: server,
|
||||
link: source?.url,
|
||||
type: source?.isM3U8 ? 'm3u8' : 'mp4',
|
||||
type: source?.isM3U8 ? "m3u8" : "mp4",
|
||||
headers: {
|
||||
Referer: 'https://megacloud.club/',
|
||||
Origin: 'https://megacloud.club',
|
||||
Referer: "https://megacloud.club/",
|
||||
Origin: "https://megacloud.club",
|
||||
},
|
||||
subtitles: subtitles,
|
||||
});
|
||||
@@ -46,7 +46,7 @@ export const hiGetStream = async function ({
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}),
|
||||
})
|
||||
);
|
||||
return streamLinks;
|
||||
} catch (err) {
|
||||
Reference in New Issue
Block a user