hammer-scrape
Version:
Unifies Cheerio and Puppeteer for the most streamline scraping experience
40 lines (39 loc) • 1.66 kB
TypeScript
import { PuppeteerRequest, PuppeteerManager } from 'request-group-puppeteer';
import { ParsingCore } from '../web_scraping_engine';
import * as puppeteer from 'puppeteer';
/**
* The configuration we expect to be utilizing
*/
export interface PuppeteerParsingCoreConfiguration {
sharedRequest: PuppeteerRequest | null;
}
/**
* Default configuration options for this parsing core
*/
export declare const PUPPETEER_PARSING_CORE_DEFAULT: PuppeteerParsingCoreConfiguration;
export declare class PuppeteerParsingCore extends ParsingCore<puppeteer.Page, PuppeteerParsingCoreConfiguration> {
private request;
private manager;
private initialized;
private sharingManager;
constructor(url: string, sharedManager?: PuppeteerManager);
private isInitialized;
getRequest(): PuppeteerRequest;
initialize(data?: PuppeteerParsingCoreConfiguration): Promise<void>;
getText(querySelector: string): Promise<string>;
getTextAll(querySelector: string): Promise<string[]>;
getAttribute(querySelector: string, attributeName: string): Promise<string>;
getAttributeAll(querySelector: string, attributeName: string): Promise<string[]>;
getHtml(querySelector: string): Promise<string>;
getHtmlAll(querySelector: string): Promise<string[]>;
elementExist(querySelector: string, timeout?: number): Promise<boolean>;
elementCount(querySelector: string): Promise<number>;
getSelectOptions(querySelector: string): Promise<{
text: string;
value: string;
}[]>;
raw(): puppeteer.Page;
dispose(): Promise<void>;
getDocumentHtml(): Promise<string>;
}
export default PuppeteerParsingCore;