krabber
Version:
Easy to use webscraper
23 lines (22 loc) • 751 B
TypeScript
import { AxiosInstance, AxiosRequestConfig } from 'axios';
export interface ScrapeConfig {
url: URL;
select: {
[key: string]: any | ((arg: SelectArguments) => any);
};
options?: AxiosRequestConfig;
axiosInstance?: AxiosInstance;
paginate?: {
next: (arg: SelectArguments) => URL | false;
map?: (arg: SelectArguments) => (pageResult: any, currentIndex?: number) => any;
reduce?: (arg: SelectArguments) => (accumulator: any, currentValue: any, currentIndex?: number, array?: any[]) => any;
};
}
export interface SelectArguments {
dom: any;
res: any;
prev: any;
url: string;
}
export declare type URL = string;
export declare function Scrape(config: ScrapeConfig): Promise<any>;