import { BrowserPlugin, type LaunchContext } from 'crawlee'; import type { NewPageResult } from './browser-controller.js'; import CDPBrowserController from './browser-controller.js'; import type { LaunchReturn } from './launcher-wrap.js'; import { CdpLauncher } from './launcher-wrap.js'; type Library = CdpLauncher; type LaunchResult = LaunchReturn; interface NewPageOptions { } /** * Humanization options for simulating realistic user behavior * All options are disabled by default for performance */ export interface HumanizationOptions { /** Enable mouse movement humanization. Default: false */ mouse?: boolean; /** Enable keyboard humanization. Default: false */ keyboard?: boolean; /** Enable scroll humanization. Default: false */ scroll?: boolean; } export interface LaunchBrowserOptions { browserType: "chrome" | "firefox"; useIncognitoPages: boolean; proxyUrl?: string; ignoreHttpsErrors: boolean; headless?: boolean; executablePath?: string; useExperimentalFingerprints?: boolean; /** Whether to start the browser maximized and fullscreen. Default: true */ maximizeWindow?: boolean; /** Window width in pixels. Default: 1920 */ windowWidth?: number; /** Window height in pixels. Default: 1080 */ windowHeight?: number; /** Optional persistent Chrome profile directory. */ userDataDir?: string; /** Keep profile directory after browser closes. */ keepUserDataDir?: boolean; /** DNS-over-HTTPS endpoint template. */ dnsOverHttpsServer?: string; /** Secure DNS mode. */ secureDnsMode?: 'off' | 'automatic' | 'secure'; /** WebRTC IP handling policy passed to Chrome flag. */ webrtcIpHandlingPolicy?: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'; viewport?: { width: number; height: number; deviceScaleFactor: number; mobile: boolean; }; fingerprintOptions?: { enableAdvancedStealth?: boolean; bypassRuntimeEnable?: boolean; spoofWebGL?: boolean; spoofAudioContext?: boolean; spoofClientRects?: boolean; maskAutomationFlags?: boolean; useFingerprintDefaults?: boolean; platform?: 'Win32' | 'MacIntel' | 'Linux x86_64'; spoofFonts?: boolean; spoofPerformance?: boolean; spoofLocale?: boolean; detectTimezone?: boolean; bypassCDPDetection?: boolean; spoofStorage?: boolean; spoofTiming?: boolean; enableDataDomeBypass?: boolean; webRtcPolicy?: 'spoof' | 'disable'; /** Humanization options (all disabled by default) */ humanization?: HumanizationOptions; /** Enable debug logging in browser console. Default: true for debugging */ debug?: boolean; }; } export default class CDPBrowserPlugin extends BrowserPlugin { private static readonly PORT_RANGE; private static usedPorts; private static lastAssignedPort; private static portLock; private getNextAvailablePort; private _cleanupStalePorts; private _isPortAvailable; private releasePort; /** */ protected _addProxyToLaunchOptions(): Promise; /** * Determines if the browser is Chromium-based. * * @private */ protected _isChromiumBasedBrowser(launchContext: LaunchContext): boolean; /** * Launches the browser using Chrome Remote Interface (CDP). * * @private */ protected _launch(launchContext: LaunchContext): Promise; /** * Creates a new browser controller. * * @private */ protected _createController(): CDPBrowserController; /** * Launches a browser with a new profile. * * @private */ private _launchBrowser; /** * Waits for a port to be available. * * @private */ private _waitForPort; /** * Tries to connect to the browser using CDP with retries. * * @private */ private _connectWithRetry; } export {}; //# sourceMappingURL=browser-plugin.d.ts.map