UNPKG

@ytb-dw/sdk

Version:

Official JavaScript SDK for ytb-dw YouTube download service - Download YouTube videos and audio with ease

40 lines (29 loc) 1.04 kB
export interface VideoInfo { success: boolean; title: string; duration: string; uploader: string; view_count: number; formats: VideoFormat[]; error?: string; } export interface VideoFormat { type: string; quality: string; size: string; } export interface DownloadOptions { format?: 'audio' | 'video'; quality?: '480' | '720' | '1080' | 'best'; } export declare class YtbDwClient { constructor(apiKey: string, baseUrl?: string); getVideoInfo(url: string): Promise<VideoInfo>; downloadVideo(url: string, options?: DownloadOptions): Promise<Response>; downloadAudio(url: string): Promise<Response>; downloadVideoQuality(url: string, quality: '480' | '720' | '1080' | 'best'): Promise<Response>; getDownloadUrl(url: string, options?: DownloadOptions): string; downloadToFile(url: string, filename: string, options?: DownloadOptions): Promise<void>; openDownload(url: string, options?: DownloadOptions): void; } export default YtbDwClient;