Browser Engine Factory (engines/EngineFactory.ts)

AnyCrawl · scraping, Scraping / Crawling, engine, factory, playwright, puppeteer, cheerio, config

Factory that creates configured Playwright, Puppeteer, or Cheerio engines with launch context and concurrency settings for scraping tasks.

// Source: https://github.com/mperkins0155/AnyCrawl | License: MIT | Copyright 2025 AnyForAI
// Provided via justclaw.it.com; keep this notice with the code.
import { RequestQueueV2, LaunchContext } from "crawlee";
import { config } from "@anycrawl/libs";
import type { EngineOptions } from "../types/engine.js";
import {
    getCloakBrowserPlaywrightLauncher,
    getCloakBrowserPuppeteerLauncher,
} from "../core/CloakBrowserLauncher.js";

// Use type-only reference to avoid runtime import of Base and engines
export type Engine = import("./Base.js").BaseEngine;

// Base factory interface
export interface IEngineFactory {
    createEngine(queue: RequestQueueV2, options?: EngineOptions): Promise<Engine>;
}

// Default configurations
const defaultOptions: EngineOptions = {
    requestHandlerTim

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key