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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
import { StagehandCrawler } from '@crawlee/stagehand';
import { z } from 'zod';
const crawler = new StagehandCrawler({
stagehandOptions: {
model: 'openai/gpt-4.1-mini',
},
async requestHandler({ page, request, log, pushData }) {
// Use standard Playwright navigation
await page.goto(request.url);
// Use AI to interact with the page
await page.act('Accept the cookie consent banner');
// Use standard Playwright for precise operations
await page.waitForSelector('.product-list');
// Use AI for complex extraction
const products = await page.extract(
'Get all product names and prices',
z.array(
z.object({
name: z.string(),
price: z.number(),
}),
),
);
log.info(`Extracted ${products.length} products`);
// Use standard Playwright for screenshots
await page.screenshot({ path: 'products.png' });
await pushData({ url: request.url, products });
},
});
await crawler.run(['https://example.com/products']);