UNPKG

ai-youtube-transcript

Version:

Fetch and process transcripts from YouTube videos with support for multiple languages, translation, and formatting

44 lines (43 loc) 1.59 kB
import { TranscriptConfig, TranscriptResponse } from './models/interfaces'; import { TranscriptList, FetchedTranscript } from './models/transcript'; import { ProxyConfig } from './proxies/proxy-config'; /** * Main class for retrieving YouTube transcripts */ export declare class YoutubeTranscript { private httpClient; /** * Legacy static method for backward compatibility * * @param videoId - Video URL or video identifier * @param config - Configuration options * @deprecated Use the instance method instead */ static fetchTranscript(videoId: string, config?: TranscriptConfig): Promise<TranscriptResponse[]>; /** * Creates a new YoutubeTranscript instance * * @param cookiePath - Path to a cookies.txt file for authentication * @param proxyConfig - Proxy configuration for handling IP bans */ constructor(cookiePath?: string, proxyConfig?: ProxyConfig); /** * Fetch transcript from a YouTube video * * @param videoId - Video URL or video identifier * @param config - Configuration options */ fetch(videoId: string, config?: TranscriptConfig): Promise<FetchedTranscript>; /** * List all available transcripts for a video * * @param videoId - Video URL or video identifier */ list(videoId: string): Promise<TranscriptList>; /** * Get languages from config, handling both new and legacy formats * * @param config - The transcript configuration */ private getLanguagesFromConfig; }