Interfaces
Key TypeScript interfaces used in the library.
VideoInfo
The main object returned by getInfoAsync.
1interface VideoInfo {
2 id: string;
3 title: string;
4 url: string;
5 thumbnail: string;
6 description: string;
7 uploader: string;
8 uploader_id: string;
9 uploader_url: string;
10 duration: number;
11 view_count: number;
12 like_count: number;
13 upload_date: string;
14
15 // Format details
16 formats: VideoFormat[];
17
18 // Subtitles
19 subtitles?: Record<string, SubtitleInfo[]>;
20 automatic_captions?: Record<string, SubtitleInfo[]>;
21
22 // Chapters
23 chapters?: ChapterInfo[];
24}
VideoFormat
Details about a specific audio/video format.
1interface VideoFormat {
2 format_id: string;
3 url: string;
4 ext: string;
5 format: string; // e.g., "137 - 1920x1080 (1080p60)"
6
7 // Video details
8 resolution?: string;
9 width?: number;
10 height?: number;
11 fps?: number;
12 vcodec?: string;
13
14 // Audio details
15 acodec?: string;
16 audio_channels?: number;
17
18 filesize?: number;
19}
VideoThumbnail
1interface VideoThumbnail {
2 id: string;
3 url: string;
4 height?: number;
5 width?: number;
6 resolution?: string;
7}
VideoProgress
Progress information returned during download/stream operations.
1interface VideoProgress {
2 filename: string;
3 status: 'downloading' | 'finished';
4 downloaded?: number;
5 downloaded_str?: string;
6 total?: number;
7 total_str?: string;
8 speed?: number;
9 speed_str?: string;
10 eta?: number;
11 eta_str?: string;
12 percentage?: number;
13 percentage_str?: string;
14}
DownloadFinishResult
Result returned by download builder's run() method.
1interface DownloadFinishResult {
2 output: string;
3 filePaths: string[];
4 info: DownloadedVideoInfo[];
5 stderr: string;
6}
YtDlpContext
Shared context interface for internal operations.
1interface YtDlpContext {
2 binaryPath: string;
3 ffmpegPath?: string;
4}