crawlee-cheerio.api
Public API Report File for "@crawlee/cheerio"
Do not edit this file. It is a report generated by API Extractor.
import type { AddRequestsBatchedResult } from '@crawlee/http';
import * as cheerio from 'cheerio';
import type { CheerioAPI } from 'cheerio';
import type { ContextPipeline } from '@crawlee/http';
import type { CrawlingContext } from '@crawlee/http';
import type { Dictionary } from '@crawlee/types';
import type { EnqueueLinksOptions } from '@crawlee/http';
import type { ErrorHandler } from '@crawlee/http';
import type { ExtractLinksOptions } 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 type { RequestHandler } from '@crawlee/http';
import type { RouterHandler } from '@crawlee/http';
import type { RouterRoutes } from '@crawlee/http';
import type { RouteSchemas } from '@crawlee/http';
import type { RoutesFromSchemas } from '@crawlee/http';
// @public
export class CheerioCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends CheerioCrawlingContext = CheerioCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<CheerioCrawlingContext['request']>>, StatisticStateExtension extends object = {}> extends HttpCrawler<CheerioCrawlingContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
constructor(options?: CheerioCrawlerOptions<ContextExtension, ExtendedContext, any, any, Routes, StatisticStateExtension>);
// (undocumented)
protected buildContextPipeline(): ContextPipeline<CrawlingContext, CheerioCrawlingContext>;
}
// @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, // with default to Dictionary we cant use a typed router in untyped crawler
Routes extends Record<keyof Routes, Dictionary> = Record<string, UserData>, StatisticStateExtension extends object = {}> extends HttpCrawlerOptions<CheerioCrawlingContext<UserData, JSONData>, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
}
// @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<AddRequestsBatchedResult>;
extractLinks(options?: ExtractLinksOptions): Promise<string[]>;
parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioAPI>;
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, // with default to Dictionary we cant use a typed router in untyped crawler
ContextExtension = Dictionary<never>> = ErrorHandler<CrawlingContext, CheerioCrawlingContext<UserData, JSONData> & ContextExtension>;
// @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, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<Context['request']>>>(routes?: RouterRoutes<Context, Routes>): RouterHandler<Context, Routes>;
// @public (undocumented)
export function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, Record<string, UserData>>): RouterHandler<Context, Record<string, UserData>>;
// @public (undocumented)
export function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext, const Schemas extends RouteSchemas = RouteSchemas>(schemas: Schemas): RouterHandler<Context, RoutesFromSchemas<Schemas>>;
export * from "@crawlee/http";
// (No @packageDocumentation comment for this package)