HTTP Client with Proxy Rotation (src/HttpClient.ts)

AnyCrawl · scraping, Scraping / Crawling, http, client, proxy, retry, request

Wrapper around Crawlee's got‑scraping that adds header handling, optional proxy usage, retries, and timeout control for HTTP requests.

// Source: https://github.com/mperkins0155/AnyCrawl | License: MIT | Copyright 2025 AnyForAI
// Provided via justclaw.it.com; keep this notice with the code.
import { gotScraping, Request } from 'crawlee';
import proxyConfiguration from './managers/Proxy.js';
import { log, normalizeProxyUrl } from '@anycrawl/libs';
import type { HttpResponse } from '@anycrawl/libs';

export type { HttpResponse };

export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';

export interface HttpClientOptions {
    headers?: Record<string, string>;
    body?: any;
    timeoutMs?: number;
    retries?: number;
    followRedirects?: boolean;
    requireProxy?: boolean; // default true
    cookieHeader?: string;
    proxy?: string; // per-request override, e.g. http://user:pass@host:port
}

export async functi

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

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

Get a free API key