Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

4.2 KB
Raw Blame

Public API Report File for "@crawlee/cheerio"

Do not edit this file. It is a report generated by API Extractor.


import type { AnyNode } from 'domhandler';
import type { Cheerio } from 'cheerio';
import type { CheerioAPI } from 'cheerio';
import type { CrawlingContext } from '@crawlee/http';
import type { Dictionary } from '@crawlee/types';
import { DOMCrawler } from '@crawlee/http';
import type { DOMCrawlingContext } from '@crawlee/http';
import type { ErrorHandler } from '@crawlee/http';
import type { GetUserDataFromRequest } from '@crawlee/http';
import type { HttpCrawlerOptions } 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 DOMCrawler<CheerioParseResult, Cheerio<AnyNode>, Cheerio<AnyNode>, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
    constructor(options?: CheerioCrawlerOptions<ContextExtension, ExtendedContext, any, any, Routes, StatisticStateExtension>);
}

// @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 Omit<HttpCrawlerOptions<CheerioCrawlingContext<UserData, JSONData>, ContextExtension, ExtendedContext, Routes, StatisticStateExtension>, 'contextPipelineBuilder'> {
}

// @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 DOMCrawlingContext<CheerioParseResult, Cheerio<AnyNode>, Cheerio<AnyNode>, UserData, JSONData> {
}

// @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 interface CheerioParseResult {
    // (undocumented)
    $: CheerioAPI;
    // (undocumented)
    body: string;
}

// @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)