Proxy Port logo
Articles > Crawlee

Crawlee

  1. Introduction
  2. Architecture
  3. Advantages
  4. Disadvantages
  5. Proxy
Crawlee is a web scraping and browser automation library for Node.js that helps you build reliable crawlers.

Introduction

Crawlee is a library that simplifies web scraping by providing a high-level interface for crawling and scraping websites. Crawlee handles many of the common challenges of web scraping for you, such as:
  • HTTP scraping: Crawlee makes HTTP requests that mimic browser headers and TLS fingerprints. It also rotates them automatically based on data about real-world traffic. Popular HTML parsers Cheerio and JSDOM are included.

  • Headless browsers: Crawlee builds on top of Puppeteer and Playwright and adds its own anti-blocking features and human-like fingerprints. You can switch your crawlers from HTTP to headless browsers in 3 lines of code.

  • Automatic scaling and proxy management: Crawlee automatically manages concurrency based on available system resources and smartly rotates proxies. Proxies that often time-out, return network errors or bad HTTP codes like 401 or 403 are discarded.

  • Queue and Storage: You can save files, screenshots and JSON results to disk with one line of code or plug an adapter for your DB. Your URLs are kept in a queue that ensures their uniqueness and that you don't lose progress when something fails.

  • Helpful utils and configurability: Crawlee includes tools for extracting social handles or phone numbers, infinite scrolling, blocking unwanted assets and many more. It works great out of the box but also provides rich configuration options.
Crawlee is based on TypeScript, which improves code completion and type checking in your IDE. It also supports JavaScript, so you can use it with your existing projects without much hassle.

Architecture

Crawlee has different types of crawlers for different scenarios. You can use HTTPCrawler to make simple HTTP requests and parse HTML with Cheerio or JSDOM. You can use PlaywrightCrawler or PuppeteerCrawler to control a headless browser and scrape dynamic websites with JavaScript rendering. You can also use APICrawler to call APIs and parse JSON for faster and more reliable scraping if an API is available.

Crawlee has a smart proxy management system that rotates proxies based on real-world traffic data and discards proxies that are blocked or unreliable. It also mimics browser headers and TLS fingerprints to avoid detection by anti-bot mechanisms.

Crawlee has a queue system that ensures that each URL is crawled only once and that you don't lose progress if something fails. You can also prioritize URLs based on custom criteria.

Crawlee has a storage system that allows you to save your scraped data, screenshots, files to disk or cloud with one line of code. You can also plug in your own database adapter if you prefer.

Crawlee has many helpful utilities for common scraping tasks, such as extracting social handles or phone numbers, infinite scrolling, blocking unwanted assets. It also provides rich configuration options for fine-tuning your crawlers.

As you can see, Crawlee is a powerful framework that covers your web scraping needs end-to-end.

Advantages

One of the main advantages of Crawlee is that it allows you to switch between different crawling modes with minimal code changes. You can use HTTP requests with popular HTML parsers like Cheerio or JSDOM, or you can use headless browsers like Chrome or Firefox controlled by Puppeteer or Playwright. Crawlee builds on top of these libraries and adds its own anti-blocking features and human-like fingerprints to make your crawlers appear more natural.

Another advantage of Crawlee is that it automatically scales your crawlers based on available system resources and smartly rotates proxies based on data about real-world traffic. It also ensures that your URLs are kept in a queue that prevents duplicates and preserves progress in case of failures. You can save your scraped data to disk or cloud with one line of code or plug an adapter for your own database.

Disadvantages

However, Crawlee is not a perfect solution for every web scraping project. It has some disadvantages that you should be aware of before choosing it as your tool of choice. Here are some of them:
  • Crawlee requires a lot of memory and CPU resources to run multiple concurrent requests and handle complex websites with JavaScript rendering. If you have limited hardware or budget, you may need to optimize your crawlers or use a different tool.

  • Crawlee does not have a built-in scheduler or dashboard to manage your crawlers. You need to use external tools or services to schedule your crawls, monitor their progress, and handle errors or failures.
These are some disadvantages of using Crawlee for web scraping and browser automation. Of course, these drawbacks do not outweigh the benefits of using Crawlee for many projects that require speed, reliability, and flexibility. But you should always evaluate your options carefully and choose the best tool for your specific needs.

Proxy

Crawlee supports proxy rotation.

See also:
Proxy for scraping
More