--- id: quick-start title: Quick Start description: With this short tutorial you can start scraping with Crawlee in a minute or two. To learn more, read the Introduction. --- import RunnableCodeBlock from '@site/src/components/RunnableCodeBlock'; import ApiLink from '@site/src/components/ApiLink'; import Admonition from '@theme/Admonition'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; import ThemedImage from '@theme/ThemedImage'; import CheerioSource from '!!raw-loader!roa-loader!./quick_start_cheerio.ts'; import PlaywrightSource from '!!raw-loader!roa-loader!./quick_start_playwright.ts'; import PlaywrightHeadful from '!!raw-loader!roa-loader!./headful_playwright.ts'; import PuppeteerSource from '!!raw-loader!roa-loader!./quick_start_puppeteer.ts'; import PuppeteerHeadful from '!!raw-loader!roa-loader!./headful_puppeteer.ts'; import CheerioLog from '!!raw-loader!./quick_start_cheerio.txt'; With this short tutorial you can start scraping with Crawlee in a minute or two. To learn in-depth how Crawlee works, read the [Introduction](./introduction), which is a comprehensive step-by-step guide for creating your first scraper. ## Choose your crawler Crawlee comes with three main crawler classes: `CheerioCrawler`, `PuppeteerCrawler` and `PlaywrightCrawler`. All classes share the same interface for maximum flexibility when switching between them. ### CheerioCrawler This is a plain HTTP crawler. It parses HTML using the [Cheerio](https://github.com/cheeriojs/cheerio) library and crawls the web using the specialized [got-scraping](https://github.com/apify/got-scraping) HTTP client which masks as a browser. It's very fast and efficient, but can't handle JavaScript rendering. ### PuppeteerCrawler This crawler uses a headless browser to crawl, controlled by the [Puppeteer](https://github.com/puppeteer/puppeteer) library. It can control Chromium or Chrome. Puppeteer is the de-facto standard in headless browser automation. ### PlaywrightCrawler [Playwright](https://github.com/microsoft/playwright) is a more powerful and full-featured successor to Puppeteer. It can control Chromium, Chrome, Firefox, Webkit and many other browsers. If you're not familiar with Puppeteer already, and you need a headless browser, go with Playwright. :::caution before you start Crawlee requires [Node.js 16 or later](https://nodejs.org/en/). ::: ## Installation with Crawlee CLI The fastest way to try Crawlee out is to use the **Crawlee CLI** and choose the **Getting started example**. The CLI will install all the necessary dependencies and add boilerplate code for you to play with. ```bash npx crawlee create my-crawler ``` After the installation is complete you can start the crawler like this: ```bash cd my-crawler && npm start ``` ## Manual installation You can add Crawlee to any Node.js project by running: npm install crawlee :::caution `playwright` is not bundled with Crawlee to reduce install size and allow greater flexibility. You need to explicitly install it with NPM. ๐Ÿ‘‡ ::: npm install crawlee playwright :::caution `puppeteer` is not bundled with Crawlee to reduce install size and allow greater flexibility. You need to explicitly install it with NPM. ๐Ÿ‘‡ ::: npm install crawlee puppeteer ## Crawling Run the following example to perform a recursive crawl of the Crawlee website using the selected crawler. To run the example, add a "type": "module" clause into your package.json or copy it into a file with an .mjs suffix. This enables import statements in Node.js. See Node.js docs for more information. {CheerioSource} {PlaywrightSource} {PuppeteerSource} When you run the example, you will see Crawlee automating the data extraction process in your terminal. {CheerioLog} ### Running headful browsers Browsers controlled by Puppeteer and Playwright run headless (without a visible window). You can switch to headful by adding the `headless: false` option to the crawlers' constructor. This is useful in the development phase when you want to see what's going on in the browser. {PlaywrightHeadful} {PuppeteerHeadful} When you run the example code, you'll see an automated browser blaze through the Crawlee website. :::note For the sake of this show off, we've slowed down the crawler, but rest assured, it's blazing fast in real world usage. ::: ## Results Crawlee stores data to the `./storage` directory in your current working directory. The results of your crawl will be available under `./storage/datasets/default/*.json` as JSON files. ```json title="./storage/datasets/default/000000001.json" { "url": "https://crawlee.dev/", "title": "Crawlee ยท The scalable web crawling, scraping and automation library for JavaScript/Node.js | Crawlee" } ``` :::tip You can override the storage directory by setting the `CRAWLEE_STORAGE_DIR` environment variable. ::: ## Examples and further reading You can find more examples showcasing various features of Crawlee in the [Examples](./examples) section of the documentation. To better understand Crawlee and its components you should read the [Introduction](./introduction) step-by-step guide. **Related links** - [Configuration](./guides/configuration) - [Request storage](./guides/request-storage) - [Result storage](./guides/result-storage)