youtube-transcript-node
Version:
This is a Node.js API which allows you to get the transcripts/subtitles for a given YouTube video. It also works for automatically generated subtitles and supports translating subtitles.
50 lines • 2.17 kB
TypeScript
import { AxiosInstance } from 'axios';
import { TranslationLanguage, TranscriptSnippetData } from './types.js';
export declare class FetchedTranscriptSnippet {
text: string;
start: number;
duration: number;
constructor(text: string, start: number, duration: number);
}
export declare class FetchedTranscript {
snippets: FetchedTranscriptSnippet[];
videoId: string;
language: string;
languageCode: string;
isGenerated: boolean;
constructor(snippets: FetchedTranscriptSnippet[], videoId: string, language: string, languageCode: string, isGenerated: boolean);
[Symbol.iterator](): Iterator<FetchedTranscriptSnippet>;
get length(): number;
toRawData(): TranscriptSnippetData[];
}
export declare class Transcript {
private _httpClient;
videoId: string;
private _url;
language: string;
languageCode: string;
isGenerated: boolean;
translationLanguages: TranslationLanguage[];
private _translationLanguagesDict;
constructor(httpClient: AxiosInstance, videoId: string, url: string, language: string, languageCode: string, isGenerated: boolean, translationLanguages: TranslationLanguage[]);
fetch(preserveFormatting?: boolean): Promise<FetchedTranscript>;
private _parseTranscript;
get isTranslatable(): boolean;
translate(languageCode: string): Transcript;
toString(): string;
}
export declare class TranscriptList {
videoId: string;
private _manuallyCreatedTranscripts;
private _generatedTranscripts;
private _translationLanguages;
static build: (httpClient: AxiosInstance, videoId: string, captionsJson: any) => TranscriptList;
constructor(videoId: string, manuallyCreatedTranscripts: Record<string, Transcript>, generatedTranscripts: Record<string, Transcript>, translationLanguages: TranslationLanguage[]);
[Symbol.iterator](): Iterator<Transcript>;
findTranscript(languageCodes: string[]): Transcript;
findGeneratedTranscript(languageCodes: string[]): Transcript;
findManuallyCreatedTranscript(languageCodes: string[]): Transcript;
private _findTranscript;
toString(): string;
}
//# sourceMappingURL=transcript.d.ts.map