Skip to content

JavaScript stealth crawler (Crawlee + Playwright + Camoufox)

A browser crawler built to get past bot protection. Uses Camoufox, a Firefox build that looks like a real user.

Create it locally

$scrapely create my-actor --template js-crawlee-playwright-camoufox

Main file

.JS
src/main.js
/**
 * This template is a production ready boilerplate for developing with `PlaywrightCrawler`.
 * Use this to bootstrap your projects using the most up-to-date code.
 * If you're looking for examples or want to learn more, see README.
 */

// For more information, see https://crawlee.dev
import { PlaywrightCrawler } from '@crawlee/playwright';
import { Actor } from 'scrapely';
import { launchOptions as camoufoxLaunchOptions } from 'camoufox-js';
import { firefox } from 'playwright';

// this is ESM project, and as such, it requires you to specify extensions in your relative imports
// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions
import { router } from './routes.js';

// Initialize the Scrapely SDK
await Actor.init();

const { startUrls = ['https://crawlee.dev'] } = (await Actor.getInput()) ?? {};

// `checkAccess` flag ensures the proxy credentials are valid, but the check can take a few hundred milliseconds.
// Disable it for short runs if you are sure your proxy configuration is correct
const proxyConfiguration = await Actor.createProxyConfiguration({ checkAccess: true });

const crawler = new PlaywrightCrawler({
    proxyConfiguration,
    requestHandler: router,
    launchContext: {
        launcher: firefox,
        launchOptions: await camoufoxLaunchOptions({
            headless: true,
            proxy: await proxyConfiguration.newUrl(),
            geoip: true,
            // fonts: ['Times New Roman'], // <- custom Camoufox options
        }),
    },
});

await crawler.run(startUrls);

// Exit successfully
await Actor.exit();

JavaScript stealth crawler (Crawlee + Playwright + Camoufox)

A browser crawler built to get past bot protection. Uses Camoufox, a Firefox build that looks like a real user.

Included features

  • Scrapely SDK — Actor lifecycle, input, storage and proxies
  • Crawlee — crawling, request queues, retries and storage
  • Playwright — headless browser automation
  • Camoufox — stealth Firefox build
  • Input schema — define and validate the Actor's input (.actor/input_schema.json)
  • Dataset schema — structured results with a preview view (.actor/dataset_schema.json)

Getting started locally

npm install
npm run start      # run the Actor

Deploying to Scrapely

Create an Actor from this template in the Scrapely Console (Develop new → template → Git). Scrapely creates a repository in your account, pushes this code, and builds the Actor. Every push to your repository triggers a new build.

G2
4.7/5
Excellent
Trustpilot

The internet is full of data.
Start owning yours.

Scrape.ly gives you the infrastructure, the tooling, and the team to extract, process, and operationalize web data at any scale. Setup takes minutes. The advantage lasts forever.

No credit card. No setup calls.