crawlee README

The project's README from github.com/apify/crawlee. As one markdown file: README.md.

Crawlee
A web scraping and browser automation library

apify%2Fcrawlee | Trendshift

NPM latest version Downloads Chat on discord Build Status

Crawlee covers your crawling and scraping end-to-end and helps you build reliable scrapers. Fast.

Your crawlers will appear human-like and fly under the radar of modern bot protections even with the default configuration. Crawlee gives you the tools to crawl the web for links, scrape data, and store it to disk or cloud while staying configurable to suit your project's needs.

Crawlee is available as the crawlee NPM package.

👉 View full documentation, guides and examples on the Crawlee project website 👈

Do you prefer 🐍 Python instead of JavaScript? 👉 Checkout Crawlee for Python 👈.

Installation

We recommend visiting the Introduction tutorial in Crawlee documentation for more information.

Crawlee requires Node.js 16 or higher.

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.

npx crawlee create my-crawler
cd my-crawler
npm start

Manual installation

If you prefer adding Crawlee into your own project, try the example below. Because it uses PlaywrightCrawler we also need to install Playwright. It's not bundled with Crawlee to reduce install size.

npm install crawlee playwright
import { PlaywrightCrawler, Dataset } from 'crawlee';

// PlaywrightCrawler crawls the web using a headless
// browser controlled by the Playwright library.
const crawler = new PlaywrightCrawler({
    // Use the requestHandler to process each of the crawled pages.
    async requestHandler({ request, page, enqueueLinks, log }) {
        const title = await page.title();
        log.info(`Title of ${request.loadedUrl} is '${title}'`);

        // Save results as JSON to ./storage/datasets/default
        await Dataset.pushData({ title, url: request.loadedUrl });

        // Extract links from the current page
        // and add them to the crawling queue.
        await enqueueLinks();
    },
    // Uncomment this option to see the browser window.
    // headless: false,
});

// Add first URL to the queue and start the crawl.
await crawler.run(['https://crawlee.dev']);

By default, Crawlee stores data to ./storage in the current working directory. You can override this directory via Crawlee configuration. For details, see Configuration guide, Request storage and Result storage.

Installing pre-release versions

We provide automated beta builds for every merged code change in Crawlee. You can find them in the npm list of releases. If you want to test new features or bug fixes before we release them, feel free to install a beta build like this:

npm install crawlee@next

If you also use the Apify SDK, you need to specify dependency overrides in your package.json file so that you don't end up with multiple versions of Crawlee installed:

{
    "overrides": {
       "apify": {
           "@crawlee/core": "$crawlee",
           "@crawlee/types": "$crawlee",
           "@crawlee/utils": "$crawlee"
       }
    }
}

🛠 Features

👾 HTTP crawling

💻 Real browser crawling

Usage on the Apify platform

Crawlee is open-source and runs anywhere, but since it's developed by Apify, it's easy to set up on the Apify platform and run in the cloud. Visit the Apify SDK website to learn more about deploying Crawlee to the Apify platform.

Support

If you find any bug or issue with Crawlee, please submit an issue on GitHub. For questions, you can ask on Stack Overflow, in GitHub Discussions or you can join our Discord server.

Contributing

Your code contributions are welcome, and you'll be praised to eternity! If you have any ideas for improvements, either submit an issue or create a pull request. For contribution guidelines and the code of conduct, see CONTRIBUTING.md.

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.

crawlee (apify/crawlee)

Searching Database…

26.2K ·GitHub
Что это такое?Библиотека для веб-скрапинга и автоматизации браузера на Node.js: вы пишете краулеры на JavaScript или TypeScript, чтобы обходить сайты, извлекать данные (например, для пайплайнов AI, LLM и RAG) и сохранять их на диск или в облако.
Это библиотека, под которую я пишу код, или готовое приложение для скрапинга?Это библиотека, а не приложение: вы устанавливаете npm-пакет crawlee и сами пишете краулер на JS/TS. В комплекте есть только CLI, который создаёт стартовый проект.
Как сделать с её помощью свой первый краулер?Быстрее всего: запустите Crawlee CLI и выберите пример Getting started — он установит зависимости и добавит шаблонный код, с которым можно поэкспериментировать. Или добавьте пакет crawlee в свой проект на Node.js.
Браузеры идут в комплекте или мне нужно ставить их самому?Для обхода сайтов через браузер вы сами устанавливаете Playwright или Puppeteer — Crawlee не тянет их, чтобы установка оставалась лёгкой. В остальном нужен только Node.js версии 16 или выше.
Сайты с защитой от ботов заблокируют мои краулеры?Борьба с блокировками — как раз её задача: даже с настройками по умолчанию обходы выглядят как действия человека и проходят мимо современных антибот-систем — ротация прокси, управление сессиями и браузероподобные TLS-отпечатки встроены с самого начала.
Обязательно запускать её в облаке Apify?Нет — проект с открытым исходным кодом и работает везде, где работает Node.js: от ноутбука до собственного сервера. Платформа Apify — просто необязательный облачный вариант от той же команды.
Куда попадают собранные данные?По умолчанию — в папку ./storage внутри вашей рабочей директории; путь можно переопределить в конфигурации, а хранилище подключаемое — как для табличных данных, так и для файлов.
Кроме HTML-страниц, что ещё она умеет собирать?JSON API ей тоже по зубам, плюс она скачивает файлы вроде PDF и картинок; в режиме браузера она отрисовывает страницы с большим количеством JavaScript и умеет делать скриншоты.
Какие браузеры и драйверы она поддерживает?Playwright и Puppeteer за единым интерфейсом: управляет Chrome, Firefox, WebKit и другими в headless- или headful-режиме, с автоматическим управлением браузерами.
Creator
apify
Size
172.7 MB
Stars
26.2K
Age
10y
Commits · 90 Days