xenforo-dl
Version:
XenForo Forum Downloader
57 lines • 2.15 kB
TypeScript
import deepFreeze from 'deep-freeze';
import { DeepRequired } from './utils/Misc.js';
import { DownloaderOptions } from './DownloaderOptions.js';
import Fetcher from './utils/Fetcher.js';
import Logger, { LogLevel } from './utils/logging/Logger.js';
import Bottleneck from 'bottleneck';
import Parser from './parsers/Parser.js';
export type DownloadTargetType = 'thread' | 'forum' | 'unknown';
export interface DownloaderConfig extends DeepRequired<Pick<DownloaderOptions, 'outDir' | 'dirStructure' | 'request' | 'overwrite' | 'continue'>> {
targetURL: string;
}
export interface DownloaderStartParams {
signal?: AbortSignal;
}
export interface DownloadStats {
processedForumCount: number;
processedThreadCount: number;
processedMessageCount: number;
skippedExistingAttachmentCount: number;
downloadedAttachmentCount: number;
errorCount: number;
}
export default class XenForoDownloader {
#private;
name: string;
protected pageFetchLimiter: Bottleneck;
protected attachmentDownloadLimiter: Bottleneck;
protected config: deepFreeze.DeepReadonly<DownloaderConfig>;
protected logger?: Logger | null;
protected parser: Parser;
constructor(url: string, options?: DownloaderOptions);
start(params: DownloaderStartParams): Promise<void>;
protected log(level: LogLevel, ...msg: any[]): void;
getConfig(): {
readonly targetURL: string;
readonly request: {
readonly maxRetries: number;
readonly maxConcurrent: number;
readonly minTime: {
readonly page: number;
readonly attachment: number;
};
readonly cookie: string | null;
};
readonly continue: boolean;
readonly outDir: string;
readonly dirStructure: {
readonly site: boolean;
readonly parentForumsAndSections: "all" | "none" | "immediate";
readonly thread: boolean;
readonly attachments: boolean;
};
readonly overwrite: boolean;
};
protected getFetcher(): Promise<Fetcher>;
}
//# sourceMappingURL=XenForoDownloader.d.ts.map