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.

597 B
Raw Blame
import { BaseHttpClient, type CustomFetchOptions } from '@crawlee/http-client';

/**
 * A simple HTTP client implementation using the native `fetch` API.
 *
 * Custom implementations only need to override the `fetch` method.
 */
export class CustomFetchClient extends BaseHttpClient {
    protected override async fetch(request: Request, options?: RequestInit & CustomFetchOptions): Promise<Response> {
        // The base class handles cookies, redirects, sessions, and timeouts.
        // We only need to perform the actual network request here.
        return fetch(request, options);
    }
}