UNPKG

yaytt

Version:

Blazingly fast YouTube caption extractor with deduplication.

34 lines (33 loc) 874 B
interface YouTubePlayerResponse { captions?: { playerCaptionsTracklistRenderer?: { captionTracks?: CaptionTrack[]; }; }; } interface CaptionTrack { baseUrl: string; languageCode: string; name: { simpleText: string; }; kind?: string; } interface VTTCue { start: number; end: number; text: string; } export declare class YouTubeAPI { private static readonly INNERTUBE_ENDPOINT; private static readonly FALLBACK_API_KEY; private static readonly USER_AGENT; getVideoInfo(videoId: string): Promise<YouTubePlayerResponse>; private extractApiKey; getCaptionTracks(videoId: string): Promise<CaptionTrack[]>; downloadCaptions(captionUrl: string): Promise<string>; parseVTT(vttContent: string): VTTCue[]; private parseTimestamp; private cleanCaptionText; } export {};