all-downloader
Version:
Download your favorite videos from online websites with ease
51 lines (49 loc) • 1.75 kB
text/typescript
/**
* Represents the main class for interacting with the API.
*/
declare class AllDownloader {
private activationKey;
private apiToken;
/**
* Private constructor to enforce use of static factory method.
*/
private constructor();
/**
* Creates and initializes an instance of AllDownloader.
* @returns {Promise<AllDownloader>} A promise that resolves to an initialized AllDownloader instance.
*/
static createInstance(): Promise<AllDownloader>;
/**
* Initializes the downloader by retrieving API credentials.
* @private
* @throws Will throw an error if initialization fails.
*/
private initialize;
/**
* Requests a trial API key and activation credentials from the API.
* @private
* @returns {Promise<LicenseTrialData | null>} The license data or null if an error occurs.
*/
private generateApiKey;
/**
* Parses a video URL and retrieves its metadata.
* @param {string} url - The URL of the video to parse.
* @returns {Promise<VideoData | null>} The parsed video data, or null if parsing fails.
* @throws Will throw an error if the URL is invalid.
*/
parse(url: string): Promise<VideoData | null>;
/**
* Validates the provided URL.
* @private
* @param {string} url - The URL to validate.
* @returns {boolean} True if the URL is valid, false otherwise.
*/
private isValidUrl;
}
/**
* Parses a video URL using a singleton instance of AllDownloader.
* @param {string} url - The video URL to parse.
* @returns {Promise<VideoData | null>} Parsed video metadata or null on failure.
*/
declare function parse(url: string): Promise<VideoData | null>;
export { AllDownloader, parse };