63 lines
2.2 KiB
TypeScript
63 lines
2.2 KiB
TypeScript
import { VideoInfo, DownloadOptions, YtDlpOptions, FormatOptions, VideoInfoOptions, VideoFormat } from './types.js';
|
|
/**
|
|
* A wrapper class for the yt-dlp command line tool
|
|
*/
|
|
export declare class YtDlp {
|
|
private options;
|
|
private executable;
|
|
/**
|
|
* Create a new YtDlp instance
|
|
* @param options Configuration options for yt-dlp
|
|
*/
|
|
constructor(options?: YtDlpOptions);
|
|
/**
|
|
* Check if yt-dlp is installed and accessible
|
|
* @returns Promise resolving to true if yt-dlp is installed, false otherwise
|
|
*/
|
|
isInstalled(): Promise<boolean>;
|
|
/**
|
|
* Download a video from a given URL
|
|
* @param url The URL of the video to download
|
|
* @param options Download options
|
|
* @returns Promise resolving to the path of the downloaded file
|
|
*/
|
|
downloadVideo(url: string, options?: DownloadOptions): Promise<string>;
|
|
/**
|
|
* Search for possible filenames in yt-dlp output
|
|
* @param stdout The stdout output from yt-dlp
|
|
* @param outputDir The output directory
|
|
* @returns Array of possible filenames found
|
|
*/
|
|
private searchPossibleFilenames;
|
|
/**
|
|
* Get information about a video without downloading it
|
|
* @param url The URL of the video to get information for
|
|
* @returns Promise resolving to video information
|
|
*/
|
|
/**
|
|
* Escapes a string for shell use based on the current platform
|
|
* @param str The string to escape
|
|
* @returns The escaped string
|
|
*/
|
|
private escapeShellArg;
|
|
getVideoInfo(url: string, options?: VideoInfoOptions): Promise<VideoInfo>;
|
|
/**
|
|
* List available formats for a video
|
|
* @param url The URL of the video to get formats for
|
|
* @returns Promise resolving to an array of VideoFormat objects
|
|
*/
|
|
listFormats(url: string, options?: FormatOptions): Promise<VideoFormat[]>;
|
|
/**
|
|
* Parse the format list output from yt-dlp into an array of VideoFormat objects
|
|
* @param output The raw output from yt-dlp format listing
|
|
* @returns Array of VideoFormat objects
|
|
*/
|
|
private parseFormatOutput;
|
|
/**
|
|
* Set the path to the yt-dlp executable
|
|
* @param path Path to the yt-dlp executable
|
|
*/
|
|
setExecutablePath(path: string): void;
|
|
}
|
|
export default YtDlp;
|
|
//# sourceMappingURL=ytdlp.d.ts.map
|