kodikwrapper
Version:
A kodikapi.com wrapper for Node.JS
65 lines (62 loc) • 2.3 kB
TypeScript
import { ObjectOrUnknown } from './types.js';
declare const KODIK_PLAYER_DOMAIN = "kodik.info";
declare const KODIK_VIDEO_INFO_ENDPOINT = "/ftor";
interface KodikParsedLinkExUrlParams {
d: string;
d_sign: string;
pd: string;
pd_sign: string;
ref: string;
ref_sign: string;
translations: boolean;
advert_debug: boolean;
min_age: number;
first_url: boolean;
}
interface KodikParsedLinkExTranslation {
id: number;
title: string;
}
interface KodikParsedLinkExSkipButtons {
type: string;
data: string;
}
type KodikVideoSourceQuality = '1080' | '720' | '480' | '360' | '240' | string;
interface KodikVideoSource {
src: string;
type: string;
}
type KodikVideoLinks = Record<KodikVideoSourceQuality, KodikVideoSource[]>;
interface KodikParsedLinkEx {
urlParams: KodikParsedLinkExUrlParams;
playerSingleUrl?: string;
translation: KodikParsedLinkExTranslation;
skipButtons?: KodikParsedLinkExSkipButtons;
}
interface VideoLinksParseParams<Extended extends boolean = false> {
link: string;
extended?: Extended;
}
type KodikParsedLink<Extended extends boolean = false> = {
host: string;
type: string;
id: string;
hash: string;
quality: string;
} & ObjectOrUnknown<Extended, Record<'ex', KodikParsedLinkEx>>;
interface VideoLinksGetLinksParams {
link: string;
videoInfoEndpoint?: string;
}
declare const kodikPlayerLinkRegexp: RegExp;
declare class VideoLinks {
static parseLink<Extended extends boolean>({ extended, link }: VideoLinksParseParams<Extended>): Promise<KodikParsedLink<Extended>>;
static normalizeKodikLink(input: string): string;
static getActualVideoInfoEndpoint(playerSingleUrl: string): Promise<string>;
static getLinks({ link, videoInfoEndpoint }: VideoLinksGetLinksParams): Promise<KodikVideoLinks>;
static parseSkipButtons: (skipButtons: KodikParsedLinkExSkipButtons) => {
from: string;
to: string;
}[];
}
export { KODIK_PLAYER_DOMAIN, KODIK_VIDEO_INFO_ENDPOINT, KodikParsedLink, KodikParsedLinkEx, KodikParsedLinkExSkipButtons, KodikParsedLinkExTranslation, KodikParsedLinkExUrlParams, KodikVideoLinks, KodikVideoSource, KodikVideoSourceQuality, VideoLinks, VideoLinksGetLinksParams, VideoLinksParseParams, kodikPlayerLinkRegexp };