EN
FRENCH
繁体中文
Crawlee is an open-source web crawling and browser automation library for Node.js.
It provides a high-level framework for building scalable crawlers that can work with both static and dynamic websites. Crawlee supports HTTP-based scraping as well as browser automation through tools such as Puppeteer and Playwright.
Also known as: Crawling framework, Crawlee.js.
Crawlee manages many of the tasks required in a web crawling workflow, including:
Developers can choose between lightweight HTTP-based crawlers and browser-based crawlers depending on how the target website loads its content.
Crawlee and Puppeteer can both be used in web automation, but they operate at different levels.
Puppeteer primarily controls Chromium-based browsers and provides direct access to browser actions such as navigation, clicking, and JavaScript execution.
Crawlee can use Puppeteer while also providing additional crawling features such as URL queues, proxy handling, session management, retries, and concurrency control.
In simple terms:
Cheerio is a lightweight library for parsing and querying static HTML.
Crawlee provides a broader crawling framework and can use Cheerio for static pages while also supporting browser-based scraping for dynamic content.
Cheerio is useful when only HTML parsing is required, while Crawlee is better suited to workflows that involve multiple URLs, queues, sessions, and automated request management.
Crawlee includes support for proxy configuration and rotation.
A crawler can route requests through different proxy servers while Crawlee manages sessions, retries, and request queues.
This can be useful for workflows such as:
Proxy management is part of the network layer, while Crawlee controls the crawling logic and extraction workflow.
The following example uses Crawlee's CheerioCrawler to retrieve page titles from multiple URLs:
import { CheerioCrawler } from 'crawlee';
const crawler = new CheerioCrawler({
async requestHandler({ request, $ }) {
const title = $('title').text();
console.log(`Title of ${request.url}: ${title}`);
},
});
await crawler.run([
{ url: 'https://example.com' },
{ url: 'https://another-site.com' },
]);
The crawler visits each URL, parses the returned HTML, extracts the <title> element, and prints the page title.
Partnership