agsamantha/node_modules/youtube-transcript/dist/index.d.ts

44 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
export declare class YoutubeTranscriptError extends Error {
constructor(message: any);
}
export declare class YoutubeTranscriptTooManyRequestError extends YoutubeTranscriptError {
constructor();
}
export declare class YoutubeTranscriptVideoUnavailableError extends YoutubeTranscriptError {
constructor(videoId: string);
}
export declare class YoutubeTranscriptDisabledError extends YoutubeTranscriptError {
constructor(videoId: string);
}
export declare class YoutubeTranscriptNotAvailableError extends YoutubeTranscriptError {
constructor(videoId: string);
}
export declare class YoutubeTranscriptNotAvailableLanguageError extends YoutubeTranscriptError {
constructor(lang: string, availableLangs: string[], videoId: string);
}
export interface TranscriptConfig {
lang?: string;
}
export interface TranscriptResponse {
text: string;
duration: number;
offset: number;
lang?: string;
}
/**
* Class to retrieve transcript if exist
*/
export declare class YoutubeTranscript {
/**
* Fetch transcript from YTB Video
* @param videoId Video url or video identifier
* @param config Get transcript in a specific language ISO
*/
static fetchTranscript(videoId: string, config?: TranscriptConfig): Promise<TranscriptResponse[]>;
/**
* Retrieve video id from url or string
* @param videoId video url or video id
*/
private static retrieveVideoId;
}