import { FileInfo, ScraperConfig, ScraperResponse, ProgressCallback, DownloadResult } from '../types'; /** * The core class for the Terabox Downloader and Scraper library. * It handles the entire process: link parsing, API interaction, and file downloading. */ export declare class TeraboxScraper { private config; private httpClient; private readonly TERABOX_DOMAIN; private readonly API_INFO_URL; /** * Initializes the TeraboxScraper with configuration. * @param config The configuration object including the required Terabox cookie. */ constructor(config: ScraperConfig); /** * Standardized error creation utility. * @param code Error code. * @param message Error message. * @param originalError Optional original error object. * @returns A ScraperResponse with success: false and the error details. */ private createErrorResponse; /** * Extracts the share key (surl) from a Terabox share link. * @param shareLink The full Terabox share URL. * @returns The share key (surl) or null if invalid. */ private extractShareKey; /** * Fetches file information and the direct download link from a Terabox share URL. * This is a two-step process: * 1. Scrape the initial share page to get hidden parameters (shareid, uk, sign, timestamp). * 2. Use the parameters to call the internal Terabox API for file details and the download link. * @param shareLink The Terabox share link (e.g., https://www.terabox.app/s/...). * @returns A promise that resolves to a ScraperResponse containing FileInfo or an error. */ getFileInfo(shareLink: string): Promise>; /** * Downloads a file using the FileInfo object. * Implements robust progress tracking and stream-based downloading for efficiency. * @param fileInfo The FileInfo object containing the downloadLink. * @param savePath The local path to save the file (directory or full file path). * @param progressCallback Optional function to track download progress. * @returns A promise that resolves to a ScraperResponse containing DownloadResult or an error. */ downloadFile(fileInfo: FileInfo, savePath: string, progressCallback?: ProgressCallback): Promise>; }