source-scraper-core
Version:
Core files for the SourceScraper-Project
18 lines (17 loc) • 1.27 kB
TypeScript
import { IRunner, IRunnerArgs, IRunnerOptions, Runner } from './Runner';
import { IScrap, Scrap } from './Scrap';
import { IScraper, IScraperOptions, Scraper } from './Scraper';
export interface IRunnerScraperOptions<RO extends IRunnerOptions = IRunnerOptions> extends IScraperOptions {
runnerOptions?: RO;
}
export interface IRunnerScraper<T, RO extends IRunnerOptions = IRunnerOptions, RA extends IRunnerArgs<RO> = IRunnerArgs<RO>, R extends IRunner<T, RO, RA> = IRunner<T, RO, RA>, SO extends IRunnerScraperOptions<RO> = IRunnerScraperOptions<RO>> extends IScraper<T, SO> {
runner: R;
scrapFromArgs: (args: RA, options?: SO) => Promise<IScrap<T>>;
}
export declare abstract class RunnerScraper<T, RO extends IRunnerOptions = IRunnerOptions, RA extends IRunnerArgs<RO> = IRunnerArgs<RO>, R extends Runner<T, RO, RA> = Runner<T, RO, RA>, SO extends IRunnerScraperOptions<RO> = IRunnerScraperOptions<RO>> extends Scraper<T, SO> implements IRunnerScraper<T, RO, RA, R, SO> {
abstract runner: R;
scrapFromArgs(args: RA, options?: SO): Promise<Scrap<T>>;
protected transformUrl?(url: string): string;
protected abstract execWithArgs(args: RA, options: SO): Promise<T>;
protected exec(url: string, options: SO): Promise<T>;
}