4.3 KiB
4.3 KiB
API Report File for "@crawlee/cheerio"
Do not edit this file. It is a report generated by API Extractor.
import type { BasicCrawlingContext } from '@crawlee/http';
import type { BatchAddRequestsResult } from '@crawlee/types';
import * as cheerio from 'cheerio';
import type { CheerioAPI } from 'cheerio';
import { CheerioRoot } from '@crawlee/utils';
import { ContextPipeline } from '@crawlee/http';
import { CrawlingContext } from '@crawlee/http';
import type { Dictionary } from '@crawlee/types';
import type { EnqueueLinksOptions } from '@crawlee/http';
import type { ErrorHandler } from '@crawlee/http';
import type { GetUserDataFromRequest } from '@crawlee/http';
import { HttpCrawler } from '@crawlee/http';
import type { HttpCrawlerOptions } from '@crawlee/http';
import type { InternalHttpCrawlingContext } from '@crawlee/http';
import type { InternalHttpHook } from '@crawlee/http';
import { IRequestManager } from '@crawlee/http';
import type { RequestHandler } from '@crawlee/http';
import { RobotsTxtFile } from '@crawlee/utils';
import { RouterHandler } from '@crawlee/http';
import type { RouterRoutes } from '@crawlee/http';
import type { SkippedRequestCallback } from '@crawlee/http';
// @public
export class CheerioCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends CheerioCrawlingContext = CheerioCrawlingContext & ContextExtension> extends HttpCrawler<CheerioCrawlingContext, ContextExtension, ExtendedContext> {
constructor(options?: CheerioCrawlerOptions<ContextExtension, ExtendedContext>);
// (undocumented)
protected buildContextPipeline(): ContextPipeline<CrawlingContext<Dictionary>, InternalHttpCrawlingContext<any, any> & {
readonly body: string;
readonly $: CheerioAPI;
} & {
enqueueLinks: (enqueueOptions?: EnqueueLinksOptions) => Promise<BatchAddRequestsResult>;
waitForSelector: (selector: string, _timeoutMs?: number) => Promise<void>;
parseWithCheerio: (selector?: string, timeoutMs?: number) => Promise<CheerioAPI>;
}>;
}
// @internal (undocumented)
export function cheerioCrawlerEnqueueLinks(options: EnqueueLinksInternalOptions | BoundEnqueueLinksInternalOptions): Promise<unknown>;
// @public (undocumented)
export interface CheerioCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends CheerioCrawlingContext = CheerioCrawlingContext & ContextExtension, UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
JSONData extends Dictionary = any> extends HttpCrawlerOptions<CheerioCrawlingContext<UserData, JSONData>, ContextExtension, ExtendedContext> {
}
// @public (undocumented)
export interface CheerioCrawlingContext<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
JSONData extends Dictionary = any> extends InternalHttpCrawlingContext<UserData, JSONData> {
$: cheerio.CheerioAPI;
body: string;
enqueueLinks(options?: EnqueueLinksOptions): Promise<BatchAddRequestsResult>;
parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioRoot>;
waitForSelector(selector: string, timeoutMs?: number): Promise<void>;
}
// @public (undocumented)
export type CheerioErrorHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
JSONData extends Dictionary = any> = ErrorHandler<CheerioCrawlingContext<UserData, JSONData>>;
// @public (undocumented)
export type CheerioHook<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
JSONData extends Dictionary = any> = InternalHttpHook<CheerioCrawlingContext<UserData, JSONData>>;
// @public (undocumented)
export type CheerioRequestHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
JSONData extends Dictionary = any> = RequestHandler<CheerioCrawlingContext<UserData, JSONData>>;
// @public
export function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, UserData>): RouterHandler<Context>;
export * from "@crawlee/http";
// (No @packageDocumentation comment for this package)