mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
334 lines
4.9 KiB
TypeScript
334 lines
4.9 KiB
TypeScript
import {AxiosStatic} from 'axios';
|
|
import * as cheerio from 'cheerio';
|
|
import {Content} from '../zustand/contentStore';
|
|
|
|
// getPosts
|
|
export interface Post {
|
|
title: string;
|
|
link: string;
|
|
image: string;
|
|
provider?: string;
|
|
}
|
|
|
|
export declare enum TextTrackType {
|
|
SUBRIP = 'application/x-subrip',
|
|
TTML = 'application/ttml+xml',
|
|
VTT = 'text/vtt',
|
|
}
|
|
|
|
export type TextTracks = {
|
|
title: string;
|
|
language: ISO639_1;
|
|
type: TextTrackType;
|
|
uri: string;
|
|
}[];
|
|
|
|
// getStream
|
|
export interface Stream {
|
|
server: string;
|
|
link: string;
|
|
type: string;
|
|
quality?: '360' | '480' | '720' | '1080' | '2160';
|
|
subtitles?: TextTracks;
|
|
headers?: any;
|
|
}
|
|
|
|
// getInfo
|
|
export interface Info {
|
|
title: string;
|
|
image: string;
|
|
synopsis: string;
|
|
imdbId: string;
|
|
type: string;
|
|
tags?: string[];
|
|
cast?: string[];
|
|
rating?: string;
|
|
linkList: Link[];
|
|
}
|
|
// getEpisodeLinks
|
|
export interface EpisodeLink {
|
|
title: string;
|
|
link: string;
|
|
}
|
|
|
|
export interface Link {
|
|
title: string;
|
|
quality?: string;
|
|
episodesLink?: string;
|
|
directLinks?: {
|
|
title: string;
|
|
link: string;
|
|
type?: 'movie' | 'series';
|
|
}[];
|
|
}
|
|
|
|
// catalog
|
|
export interface Catalog {
|
|
title: string;
|
|
filter: string;
|
|
}
|
|
|
|
export interface ProviderType {
|
|
searchFilter?: string;
|
|
catalog: Catalog[];
|
|
genres: Catalog[];
|
|
blurImage?: boolean;
|
|
nonStreamableServer?: string[];
|
|
nonDownloadableServer?: string[];
|
|
GetStream: ({
|
|
link,
|
|
type,
|
|
signal,
|
|
providerContext,
|
|
}: {
|
|
link: string;
|
|
type: string;
|
|
signal: AbortSignal;
|
|
providerContext: ProviderContext;
|
|
}) => Promise<Stream[]>;
|
|
GetHomePosts: ({
|
|
filter,
|
|
page,
|
|
providerValue,
|
|
signal,
|
|
providerContext,
|
|
}: {
|
|
filter: string;
|
|
page: number;
|
|
providerValue: string;
|
|
signal: AbortSignal;
|
|
providerContext: ProviderContext;
|
|
}) => Promise<Post[]>;
|
|
GetEpisodeLinks?: ({
|
|
url,
|
|
providerContext,
|
|
}: {
|
|
url: string;
|
|
providerContext: ProviderContext;
|
|
}) => Promise<EpisodeLink[]>;
|
|
GetMetaData: ({
|
|
link,
|
|
provider,
|
|
providerContext,
|
|
}: {
|
|
link: string;
|
|
provider: Content['provider'];
|
|
providerContext: ProviderContext;
|
|
}) => Promise<Info>;
|
|
GetSearchPosts: ({
|
|
searchQuery,
|
|
page,
|
|
providerValue,
|
|
signal,
|
|
providerContext,
|
|
}: {
|
|
searchQuery: string;
|
|
page: number;
|
|
providerValue: string;
|
|
signal: AbortSignal;
|
|
providerContext: ProviderContext;
|
|
}) => Promise<Post[]>;
|
|
}
|
|
|
|
export type ProviderContext = {
|
|
axios: AxiosStatic;
|
|
Aes: any; // AES encryption utility, if used
|
|
getBaseUrl: (providerValue: string) => Promise<string>;
|
|
commonHeaders: Record<string, string>;
|
|
cheerio: typeof cheerio;
|
|
extractors: {
|
|
hubcloudExtracter: (link: string, signal: AbortSignal) => Promise<Stream[]>;
|
|
gofileExtracter: (id: string) => Promise<{
|
|
link: string;
|
|
token: string;
|
|
}>;
|
|
superVideoExtractor: (data: any) => Promise<string>;
|
|
gdFlixExtracter: (link: string, signal: AbortSignal) => Promise<Stream[]>;
|
|
};
|
|
};
|
|
|
|
export type ISO639_1 =
|
|
| 'aa'
|
|
| 'ab'
|
|
| 'ae'
|
|
| 'af'
|
|
| 'ak'
|
|
| 'am'
|
|
| 'an'
|
|
| 'ar'
|
|
| 'as'
|
|
| 'av'
|
|
| 'ay'
|
|
| 'az'
|
|
| 'ba'
|
|
| 'be'
|
|
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