@crawlee/core 3.0.0-beta.9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -133
- package/autoscaling/autoscaled_pool.d.ts +5 -5
- package/autoscaling/autoscaled_pool.d.ts.map +1 -1
- package/autoscaling/autoscaled_pool.js +16 -16
- package/autoscaling/autoscaled_pool.js.map +1 -1
- package/autoscaling/snapshotter.d.ts +6 -6
- package/autoscaling/snapshotter.d.ts.map +1 -1
- package/autoscaling/snapshotter.js +12 -8
- package/autoscaling/snapshotter.js.map +1 -1
- package/autoscaling/system_status.d.ts +1 -1
- package/autoscaling/system_status.d.ts.map +1 -1
- package/configuration.d.ts +77 -62
- package/configuration.d.ts.map +1 -1
- package/configuration.js +85 -87
- package/configuration.js.map +1 -1
- package/crawlers/crawler_commons.d.ts +7 -12
- package/crawlers/crawler_commons.d.ts.map +1 -1
- package/crawlers/crawler_utils.d.ts +1 -1
- package/crawlers/crawler_utils.d.ts.map +1 -1
- package/crawlers/statistics.d.ts.map +1 -1
- package/crawlers/statistics.js +1 -1
- package/crawlers/statistics.js.map +1 -1
- package/enqueue_links/enqueue_links.d.ts +25 -23
- package/enqueue_links/enqueue_links.d.ts.map +1 -1
- package/enqueue_links/enqueue_links.js +23 -23
- package/enqueue_links/enqueue_links.js.map +1 -1
- package/enqueue_links/shared.d.ts +11 -6
- package/enqueue_links/shared.d.ts.map +1 -1
- package/enqueue_links/shared.js +7 -2
- package/enqueue_links/shared.js.map +1 -1
- package/errors.d.ts +16 -0
- package/errors.d.ts.map +1 -0
- package/errors.js +22 -0
- package/errors.js.map +1 -0
- package/events/event_manager.d.ts +12 -8
- package/events/event_manager.d.ts.map +1 -1
- package/events/event_manager.js +17 -6
- package/events/event_manager.js.map +1 -1
- package/events/local_event_manager.d.ts +3 -5
- package/events/local_event_manager.d.ts.map +1 -1
- package/events/local_event_manager.js +3 -5
- package/events/local_event_manager.js.map +1 -1
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/index.mjs +6 -0
- package/package.json +22 -27
- package/proxy_configuration.d.ts +7 -14
- package/proxy_configuration.d.ts.map +1 -1
- package/proxy_configuration.js +6 -15
- package/proxy_configuration.js.map +1 -1
- package/request.d.ts +11 -6
- package/request.d.ts.map +1 -1
- package/request.js +5 -1
- package/request.js.map +1 -1
- package/router.d.ts +93 -0
- package/router.d.ts.map +1 -0
- package/router.js +137 -0
- package/router.js.map +1 -0
- package/serialization.d.ts.map +1 -1
- package/serialization.js +1 -2
- package/serialization.js.map +1 -1
- package/session_pool/session.d.ts +10 -15
- package/session_pool/session.d.ts.map +1 -1
- package/session_pool/session.js +18 -18
- package/session_pool/session.js.map +1 -1
- package/session_pool/session_pool.d.ts +3 -2
- package/session_pool/session_pool.d.ts.map +1 -1
- package/session_pool/session_pool.js +4 -5
- package/session_pool/session_pool.js.map +1 -1
- package/session_pool/session_utils.d.ts +6 -5
- package/session_pool/session_utils.d.ts.map +1 -1
- package/session_pool/session_utils.js +3 -0
- package/session_pool/session_utils.js.map +1 -1
- package/storages/dataset.d.ts +37 -15
- package/storages/dataset.d.ts.map +1 -1
- package/storages/dataset.js +44 -12
- package/storages/dataset.js.map +1 -1
- package/storages/index.d.ts +1 -0
- package/storages/index.d.ts.map +1 -1
- package/storages/index.js +1 -0
- package/storages/index.js.map +1 -1
- package/storages/key_value_store.d.ts +121 -23
- package/storages/key_value_store.d.ts.map +1 -1
- package/storages/key_value_store.js +178 -24
- package/storages/key_value_store.js.map +1 -1
- package/storages/request_list.d.ts +32 -35
- package/storages/request_list.d.ts.map +1 -1
- package/storages/request_list.js +32 -24
- package/storages/request_list.js.map +1 -1
- package/storages/request_queue.d.ts +12 -8
- package/storages/request_queue.d.ts.map +1 -1
- package/storages/request_queue.js +18 -10
- package/storages/request_queue.js.map +1 -1
- package/storages/storage_manager.d.ts +9 -5
- package/storages/storage_manager.d.ts.map +1 -1
- package/storages/storage_manager.js +28 -18
- package/storages/storage_manager.js.map +1 -1
- package/storages/utils.d.ts +16 -0
- package/storages/utils.d.ts.map +1 -0
- package/storages/utils.js +26 -0
- package/storages/utils.js.map +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/typedefs.d.ts +0 -2
- package/typedefs.d.ts.map +1 -1
- package/typedefs.js.map +1 -1
- package/validators.d.ts +5 -5
- package/validators.d.ts.map +1 -1
- package/validators.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,183 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<a href="https://crawlee.dev">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/apify/crawlee/master/website/static/img/crawlee-dark.svg?sanitize=true">
|
|
5
|
+
<img alt="Crawlee" src="https://raw.githubusercontent.com/apify/crawlee/master/website/static/img/crawlee-light.svg?sanitize=true" width="500">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
<br>
|
|
9
|
+
<small>The scalable web crawling and scraping library for JavaScript</small>
|
|
10
|
+
</h1>
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
<p align=center>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/v/@crawlee/core/next.svg" alt="NPM dev version" data-canonical-src="https://img.shields.io/npm/v/@crawlee/core/next.svg" style="max-width: 100%;"></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/dm/@crawlee/core.svg" alt="Downloads" data-canonical-src="https://img.shields.io/npm/dm/@crawlee/core.svg" style="max-width: 100%;"></a>
|
|
15
|
+
<a href="https://discord.gg/jyEM2PRvMU" rel="nofollow"><img src="https://img.shields.io/discord/801163717915574323?label=discord" alt="Chat on discord" data-canonical-src="https://img.shields.io/discord/801163717915574323?label=discord" style="max-width: 100%;"></a>
|
|
16
|
+
<a href="https://github.com/apify/crawlee/actions/workflows/test-and-release.yml"><img src="https://github.com/apify/crawlee/actions/workflows/test-and-release.yml/badge.svg?branch=master" alt="Build Status" style="max-width: 100%;"></a>
|
|
17
|
+
</p>
|
|
4
18
|
|
|
5
|
-
[
|
|
6
|
-
[](https://www.npmjs.com/package/@crawlee/core)
|
|
7
|
-
[](https://discord.gg/jyEM2PRvMU)
|
|
8
|
-
[](https://github.com/apify/apify-ts/actions/workflows/test-and-release.yml)
|
|
19
|
+
>👉👉👉 Crawlee is the successor to [Apify SDK](https://sdk.apify.com). 🎉 Fully rewritten in **TypeScript** for a better developer experience, and with even more powerful anti-blocking features. The interface is almost the same as Apify SDK so upgrading is a breeze. Read [the upgrading guide](https://crawlee.dev/docs/upgrading/upgrading-to-v3) to learn about the changes. 👈👈👈
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
It provides tools to manage and automatically scale a pool of headless browsers,
|
|
12
|
-
to maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,
|
|
13
|
-
rotate proxies and much more.
|
|
14
|
-
The SDK is available as the [`apify`](https://www.npmjs.com/package/apify) NPM package.
|
|
15
|
-
It can be used either stand-alone in your own applications
|
|
16
|
-
or in [actors](https://docs.apify.com/actor)
|
|
17
|
-
running on the [Apify Cloud](https://apify.com/).
|
|
21
|
+
Crawlee simplifies the development of web crawlers, scrapers, data extractors and web automation jobs. It provides tools to manage and automatically scale a pool of headless browsers, to maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud, rotate proxies and much more. Crawlee is available as the [`crawlee`](https://www.npmjs.com/package/crawlee) NPM package. It can be used either stand-alone in your own applications or in [actors](https://docs.apify.com/actor) running on the [Apify Cloud](https://apify.com/).
|
|
18
22
|
|
|
19
|
-
**View full documentation, guides and examples on the [
|
|
23
|
+
**View full documentation, guides and examples on the [Crawlee project website](https://crawlee.dev)**
|
|
20
24
|
|
|
21
|
-
> Would you like to work with us on
|
|
25
|
+
> Would you like to work with us on Crawlee or similar projects? [We are hiring!](https://apify.com/jobs#senior-node.js-engineer)
|
|
22
26
|
|
|
23
27
|
## Motivation
|
|
24
28
|
|
|
25
|
-
Thanks to tools like [Playwright](https://github.com/microsoft/playwright), [Puppeteer](https://github.com/puppeteer/puppeteer) or
|
|
26
|
-
[Cheerio](https://www.npmjs.com/package/cheerio), it is easy to write Node.js code to extract data from web pages. But
|
|
27
|
-
eventually things will get complicated. For example, when you try to:
|
|
29
|
+
Thanks to tools like [Playwright](https://github.com/microsoft/playwright), [Puppeteer](https://github.com/puppeteer/puppeteer) or [Cheerio](https://www.npmjs.com/package/cheerio), it is easy to write Node.js code to extract data from web pages. But eventually things will get complicated. For example, when you try to:
|
|
28
30
|
|
|
29
31
|
- Perform a deep crawl of an entire website using a persistent queue of URLs.
|
|
30
32
|
- Run your scraping code on a list of 100k URLs in a CSV file, without losing any data when your code crashes.
|
|
31
33
|
- Rotate proxies to hide your browser origin and keep user-like sessions.
|
|
32
34
|
- Disable browser fingerprinting protections used by websites.
|
|
33
35
|
|
|
34
|
-
Python has [Scrapy](https://scrapy.org/) for these tasks, but there was no such library for **JavaScript, the language of
|
|
35
|
-
the web**. The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a
|
|
36
|
-
browser.
|
|
36
|
+
Python has [Scrapy](https://scrapy.org/) for these tasks, but there was no such library for **JavaScript, the language of the web**. The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a browser.
|
|
37
37
|
|
|
38
|
-
The goal of
|
|
39
|
-
reinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing
|
|
40
|
-
commonalities.
|
|
38
|
+
The goal of Crawlee is to fill this gap and provide a toolbox for generic web scraping, crawling and automation tasks in JavaScript. So don't reinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing commonalities.
|
|
41
39
|
|
|
42
40
|
## Overview
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
Crawlee is available as the [`crawlee`](https://www.npmjs.com/package/crawlee) NPM package and is also available via `@crawlee/*` packages. It provides the following tools:
|
|
45
43
|
|
|
46
|
-
- [`CheerioCrawler`](https://
|
|
47
|
-
number of web pages using the [cheerio](https://www.npmjs.com/package/cheerio) HTML parser. This is the most
|
|
48
|
-
efficient web crawler, but it does not work on websites that require JavaScript.
|
|
44
|
+
- [`CheerioCrawler`](https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler) - Enables the parallel crawling of a large number of web pages using the [cheerio](https://www.npmjs.com/package/cheerio) HTML parser. This is the most efficient web crawler, but it does not work on websites that require JavaScript. Available also under `@crawlee/cheerio` package.
|
|
49
45
|
|
|
50
|
-
- [`PuppeteerCrawler`](https://
|
|
51
|
-
a large number of web pages using the headless Chrome browser and [Puppeteer](https://github.com/puppeteer/puppeteer).
|
|
52
|
-
The pool of Chrome browsers is automatically scaled up and down based on available system resources.
|
|
46
|
+
- [`PuppeteerCrawler`](https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler) - Enables the parallel crawling of a large number of web pages using the headless Chrome browser and [Puppeteer](https://github.com/puppeteer/puppeteer). The pool of Chrome browsers is automatically scaled up and down based on available system resources. Available also under `@crawlee/puppeteer` package.
|
|
53
47
|
|
|
54
|
-
- [`PlaywrightCrawler`](https://
|
|
55
|
-
you can use [Playwright](https://github.com/microsoft/playwright) to manage almost any headless browser.
|
|
56
|
-
It also provides a cleaner and more mature interface while keeping the ease of use and advanced features.
|
|
48
|
+
- [`PlaywrightCrawler`](https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler) - Unlike `PuppeteerCrawler` you can use [Playwright](https://github.com/microsoft/playwright) to manage almost any headless browser. It also provides a cleaner and more mature interface while keeping the ease of use and advanced features. Available also under `@crawlee/playwright` package.
|
|
57
49
|
|
|
58
|
-
- [`BasicCrawler`](https://
|
|
59
|
-
crawling of web pages whose URLs are fed either from a static list or from a dynamic queue of URLs. This class
|
|
60
|
-
serves as a base for the more specialized crawlers above.
|
|
50
|
+
- [`BasicCrawler`](https://crawlee.dev/api/basic-crawler/class/BasicCrawler) - Provides a simple framework for the parallel crawling of web pages whose URLs are fed either from a static list or from a dynamic queue of URLs. This class serves as a base for the more specialized crawlers above. Available also under `@crawlee/basic` package.
|
|
61
51
|
|
|
62
|
-
- [`RequestList`](https://
|
|
63
|
-
The URLs can be passed in code or in a text file hosted on the web. The list persists its state so that crawling
|
|
64
|
-
can resume when the Node.js process restarts.
|
|
52
|
+
- [`RequestList`](https://crawlee.dev/api/core/class/RequestList) - Represents a list of URLs to crawl. The URLs can be passed in code or in a text file hosted on the web. The list persists its state so that crawling can resume when the Node.js process restarts. Available also under `@crawlee/core` package.
|
|
65
53
|
|
|
66
|
-
- [`RequestQueue`](https://
|
|
67
|
-
which is stored either on a local filesystem or in the [Apify Cloud](https://apify.com). The queue is used
|
|
68
|
-
for deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.
|
|
69
|
-
The data structure supports both breadth-first and depth-first crawling orders.
|
|
54
|
+
- [`RequestQueue`](https://crawlee.dev/api/core/class/RequestQueue) - Represents a queue of URLs to crawl, which is stored either in memory, on a local filesystem, or in the [Apify Cloud](https://apify.com). The queue is used for deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders. Available also under `@crawlee/core` package.
|
|
70
55
|
|
|
71
|
-
- [`Dataset`](https://
|
|
72
|
-
to formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.
|
|
73
|
-
Datasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.
|
|
56
|
+
- [`Dataset`](https://crawlee.dev/api/core/class/Dataset) - Provides a store for structured data and enables their export to formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud. Datasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers. Available also under `@crawlee/core` package.
|
|
74
57
|
|
|
75
|
-
- [`KeyValueStore`](https://
|
|
76
|
-
records or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs
|
|
77
|
-
or to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud.
|
|
58
|
+
- [`KeyValueStore`](https://crawlee.dev/api/core/class/KeyValueStore) - A simple key-value store for arbitrary data records or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs or to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud. Available also under `@crawlee/core` package.
|
|
78
59
|
|
|
79
|
-
- [`AutoscaledPool`](https://
|
|
80
|
-
while automatically adjusting the concurrency based on free system memory and CPU usage. This is useful for running
|
|
81
|
-
web scraping tasks at the maximum capacity of the system.
|
|
60
|
+
- [`AutoscaledPool`](https://crawlee.dev/api/core/class/AutoscaledPool) - Runs asynchronous background tasks, while automatically adjusting the concurrency based on free system memory and CPU usage. This is useful for running web scraping tasks at the maximum capacity of the system. Available also under `@crawlee/core` package.
|
|
82
61
|
|
|
83
|
-
|
|
84
|
-
for web scraping. For example, to inject jQuery into web pages or to hide browser origin.
|
|
85
|
-
|
|
86
|
-
Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus
|
|
87
|
-
take advantage of its pool of proxies, job scheduler, data storage, etc.
|
|
88
|
-
For more information, see the [Apify SDK Programmer's Reference](https://sdk.apify.com).
|
|
62
|
+
Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus take advantage of its pool of proxies, job scheduler, data storage, etc. For more information, see the [Crawlee Programmer's Reference](https://crawlee.dev).
|
|
89
63
|
|
|
90
64
|
## Quick Start
|
|
91
65
|
|
|
92
|
-
This short tutorial will set you up to start using
|
|
93
|
-
If you want to learn more, proceed to the [Getting Started](https://sdk.apify.com/docs/guides/getting-started)
|
|
94
|
-
tutorial that will take you step by step through creating your first scraper.
|
|
66
|
+
This short tutorial will set you up to start using Crawlee in a minute or two. If you want to learn more, proceed to the [Getting Started](https://crawlee.dev/docs/guides/getting-started) tutorial that will take you step by step through creating your first scraper.
|
|
95
67
|
|
|
96
68
|
### Local stand-alone usage
|
|
97
69
|
|
|
98
|
-
|
|
99
|
-
Add Apify SDK to any Node.js project by running:
|
|
70
|
+
Crawlee requires [Node.js](https://nodejs.org/en/) 16 or later. Add Crawlee to any Node.js project by running:
|
|
100
71
|
|
|
101
72
|
```bash
|
|
102
|
-
npm install
|
|
73
|
+
npm install crawlee playwright
|
|
103
74
|
```
|
|
104
75
|
|
|
105
|
-
> Neither `playwright` nor `puppeteer` are bundled with
|
|
106
|
-
> flexibility. That's why we install it with NPM. You can choose one, both, or neither.
|
|
76
|
+
> Neither `playwright` nor `puppeteer` are bundled with Crawlee to reduce install size and allow greater flexibility. That's why we install it with NPM. You can choose one, both, or neither.
|
|
107
77
|
|
|
108
|
-
Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of the
|
|
109
|
-
[see the Examples section of the documentation](https://sdk.apify.com/docs/examples/crawl-multiple-urls).
|
|
78
|
+
Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of Crawlee, [see the Examples section of the documentation](https://crawlee.dev/docs/examples/crawl-multiple-urls).
|
|
110
79
|
|
|
111
80
|
```javascript
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
console.log(`Title of ${request.url}: ${title}`);
|
|
126
|
-
|
|
127
|
-
// Add URLs that match the provided pattern.
|
|
128
|
-
await Apify.utils.enqueueLinks({
|
|
129
|
-
page,
|
|
130
|
-
requestQueue,
|
|
131
|
-
pseudoUrls: ['https://www.iana.org/[.*]'],
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
await crawler.run();
|
|
81
|
+
import { PlaywrightCrawler, Dataset } from 'crawlee';
|
|
82
|
+
|
|
83
|
+
const crawler = new PlaywrightCrawler();
|
|
84
|
+
|
|
85
|
+
crawler.router.addDefaultHandler(async ({ request, page, enqueueLinks }) => {
|
|
86
|
+
const title = await page.title();
|
|
87
|
+
console.log(`Title of ${request.loadedUrl} is '${title}'`);
|
|
88
|
+
|
|
89
|
+
// save some results
|
|
90
|
+
await Dataset.pushData({ title, url: request.loadedUrl });
|
|
91
|
+
|
|
92
|
+
// enqueue all links targeting the same hostname
|
|
93
|
+
await enqueueLinks();
|
|
137
94
|
});
|
|
95
|
+
|
|
96
|
+
await crawler.run(['https://www.iana.org/']);
|
|
138
97
|
```
|
|
139
98
|
|
|
140
|
-
When you run the example, you should see
|
|
99
|
+
When you run the example, you should see Crawlee automating a Chrome browser.
|
|
141
100
|
|
|
142
|
-

|
|
143
102
|
|
|
144
|
-
By default,
|
|
145
|
-
`APIFY_LOCAL_STORAGE_DIR` or `APIFY_TOKEN` environment variable. For details, see [Environment variables](https://sdk.apify.com/docs/guides/environment-variables), [Request storage](https://sdk.apify.com/docs/guides/request-storage) and [Result storage](https://sdk.apify.com/docs/guides/result-storage).
|
|
103
|
+
By default, Crawlee stores data to `./crawlee_storage` in the current working directory. You can override this directory via `CRAWLEE_STORAGE_DIR` env var. For details, see [Environment variables](https://crawlee.dev/docs/guides/environment-variables), [Request storage](https://crawlee.dev/docs/guides/request-storage) and [Result storage](https://crawlee.dev/docs/guides/result-storage).
|
|
146
104
|
|
|
147
|
-
### Local usage with
|
|
105
|
+
### Local usage with Crawlee command-line interface (CLI)
|
|
148
106
|
|
|
149
|
-
To
|
|
150
|
-
the [Apify platform](https://sdk.apify.com/docs/guides/apify-platform), you can use the [Apify command-line interface (CLI)](https://github.com/apify/apify-cli) tool.
|
|
107
|
+
To create a boilerplate of your project we can use the [Crawlee command-line interface (CLI)](https://github.com/apify/apify-cli) tool.
|
|
151
108
|
|
|
152
|
-
|
|
109
|
+
Let's create a boilerplate of your new web crawling project by running:
|
|
153
110
|
|
|
154
111
|
```bash
|
|
155
|
-
|
|
112
|
+
npx crawlee create my-hello-world
|
|
156
113
|
```
|
|
157
114
|
|
|
158
|
-
|
|
115
|
+
The CLI will prompt you to select a project boilerplate template - just pick "Hello world". The tool will create a directory called `my-hello-world` with a Node.js project files. You can run the project as follows:
|
|
159
116
|
|
|
160
117
|
```bash
|
|
161
|
-
|
|
118
|
+
cd my-hello-world
|
|
119
|
+
npx crawlee run
|
|
162
120
|
```
|
|
163
121
|
|
|
164
|
-
|
|
165
|
-
with a Node.js project files. You can run the project as follows:
|
|
122
|
+
By default, the crawling data will be stored in a local directory at `./crawlee_storage`. For example, the input JSON file for the actor is expected to be in the default key-value store in `./crawlee_storage/key_value_stores/default/INPUT.json`.
|
|
166
123
|
|
|
167
|
-
|
|
168
|
-
cd my-hello-world
|
|
169
|
-
apify run
|
|
170
|
-
```
|
|
124
|
+
### Usage on the Apify platform
|
|
171
125
|
|
|
172
|
-
|
|
173
|
-
be in the default key-value store in `./apify_storage/key_value_stores/default/INPUT.json`.
|
|
126
|
+
Now if we want to run our new crawler on Apify Platform, we first need to download the `apify-cli` and login with our token:
|
|
174
127
|
|
|
175
|
-
|
|
128
|
+
> We could also use the Apify CLI to generate a new project, which can be better suited if we want to run it on the Apify Platform.
|
|
176
129
|
|
|
177
130
|
```bash
|
|
131
|
+
npm i -g apify-cli
|
|
178
132
|
apify login
|
|
179
133
|
```
|
|
180
134
|
|
|
135
|
+
Finally, we can easily deploy our code to the Apify platform by running:
|
|
136
|
+
|
|
181
137
|
```bash
|
|
182
138
|
apify push
|
|
183
139
|
```
|
|
@@ -185,32 +141,18 @@ apify push
|
|
|
185
141
|
Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the
|
|
186
142
|
[Apify Actor](https://docs.apify.com/cli) documentation.
|
|
187
143
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
You can also develop your web scraping project in an online code editor directly on the [Apify platform](https://sdk.apify.com/docs/guides/apify-platform).
|
|
191
|
-
You'll need to have an Apify Account. Go to [Actors](https://console.apify.com/actors), page in the Apify Console, click <i>Create new</i>
|
|
192
|
-
and then go to the <i>Source</i> tab and start writing your code or paste one of the examples from the Examples section.
|
|
144
|
+
You can also develop your web scraping project in an online code editor directly on the [Apify platform](https://crawlee.dev/docs/guides/apify-platform). You'll need to have an Apify Account. Go to [Actors](https://console.apify.com/actors), page in the Apify Console, click <i>Create new</i> and then go to the <i>Source</i> tab and start writing your code or paste one of the examples from the Examples section.
|
|
193
145
|
|
|
194
146
|
For more information, view the [Apify actors quick start guide](https://docs.apify.com/actor/quick-start).
|
|
195
147
|
|
|
196
148
|
## Support
|
|
197
149
|
|
|
198
|
-
If you find any bug or issue with
|
|
199
|
-
For questions, you can ask on [Stack Overflow](https://stackoverflow.com/questions/tagged/apify) or contact support@apify.com
|
|
150
|
+
If you find any bug or issue with Crawlee, please [submit an issue on GitHub](https://github.com/apify/crawlee/issues). For questions, you can ask on [Stack Overflow](https://stackoverflow.com/questions/tagged/apify) or contact support@apify.com
|
|
200
151
|
|
|
201
152
|
## Contributing
|
|
202
153
|
|
|
203
|
-
Your code contributions are welcome and you'll be praised to eternity!
|
|
204
|
-
If you have any ideas for improvements, either submit an issue or create a pull request.
|
|
205
|
-
For contribution guidelines and the code of conduct,
|
|
206
|
-
see [CONTRIBUTING.md](https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md).
|
|
154
|
+
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](https://github.com/apify/crawlee/blob/master/CONTRIBUTING.md).
|
|
207
155
|
|
|
208
156
|
## License
|
|
209
157
|
|
|
210
|
-
This project is licensed under the Apache License 2.0 -
|
|
211
|
-
see the [LICENSE.md](https://github.com/apify/apify-js/blob/master/LICENSE.md) file for details.
|
|
212
|
-
|
|
213
|
-
## Acknowledgments
|
|
214
|
-
|
|
215
|
-
Many thanks to [Chema Balsas](https://www.npmjs.com/~jbalsas) for giving up the `apify` package name
|
|
216
|
-
on NPM and renaming his project to [jsdocify](https://www.npmjs.com/package/jsdocify).
|
|
158
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE.md](https://github.com/apify/crawlee/blob/master/LICENSE.md) file for details.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Log } from '@apify/log';
|
|
1
|
+
import type { Log } from '@apify/log';
|
|
2
2
|
import { Configuration } from '../configuration';
|
|
3
|
-
import { SnapshotterOptions } from './snapshotter';
|
|
4
|
-
import { SystemInfo, SystemStatusOptions } from './system_status';
|
|
3
|
+
import type { SnapshotterOptions } from './snapshotter';
|
|
4
|
+
import type { SystemInfo, SystemStatusOptions } from './system_status';
|
|
5
5
|
export interface AutoscaledPoolOptions {
|
|
6
6
|
/**
|
|
7
7
|
* A function that performs an asynchronous resource-intensive task.
|
|
@@ -33,7 +33,7 @@ export interface AutoscaledPoolOptions {
|
|
|
33
33
|
minConcurrency?: number;
|
|
34
34
|
/**
|
|
35
35
|
* The maximum number of tasks running in parallel.
|
|
36
|
-
* @default
|
|
36
|
+
* @default 200
|
|
37
37
|
*/
|
|
38
38
|
maxConcurrency?: number;
|
|
39
39
|
/**
|
|
@@ -44,7 +44,7 @@ export interface AutoscaledPoolOptions {
|
|
|
44
44
|
desiredConcurrency?: number;
|
|
45
45
|
/**
|
|
46
46
|
* Minimum level of desired concurrency to reach before more scaling up is allowed.
|
|
47
|
-
* @default 0.
|
|
47
|
+
* @default 0.90
|
|
48
48
|
*/
|
|
49
49
|
desiredConcurrencyRatio?: number;
|
|
50
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoscaled_pool.d.ts","sourceRoot":"","sources":["../../src/autoscaling/autoscaled_pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"autoscaled_pool.d.ts","sourceRoot":"","sources":["../../src/autoscaling/autoscaled_pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAKtC,OAAO,EAAE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245
|
runTaskFunction: ow_1.default.function,
|
|
246
246
|
isFinishedFunction: ow_1.default.function,
|
|
247
247
|
isTaskReadyFunction: ow_1.default.function,
|
|
248
|
-
maxConcurrency: ow_1.default.optional.number,
|
|
249
|
-
minConcurrency: ow_1.default.optional.number,
|
|
250
|
-
desiredConcurrency: ow_1.default.optional.number,
|
|
251
|
-
desiredConcurrencyRatio: ow_1.default.optional.number,
|
|
252
|
-
scaleUpStepRatio: ow_1.default.optional.number,
|
|
253
|
-
scaleDownStepRatio: ow_1.default.optional.number,
|
|
254
|
-
maybeRunIntervalSecs: ow_1.default.optional.number,
|
|
255
|
-
loggingIntervalSecs: ow_1.default.any(ow_1.default.number, ow_1.default.nullOrUndefined),
|
|
256
|
-
autoscaleIntervalSecs: ow_1.default.optional.number,
|
|
257
|
-
taskTimeoutSecs: ow_1.default.optional.number,
|
|
248
|
+
maxConcurrency: ow_1.default.optional.number.integer.greaterThanOrEqual(1),
|
|
249
|
+
minConcurrency: ow_1.default.optional.number.integer.greaterThanOrEqual(1),
|
|
250
|
+
desiredConcurrency: ow_1.default.optional.number.integer.greaterThanOrEqual(1),
|
|
251
|
+
desiredConcurrencyRatio: ow_1.default.optional.number.greaterThan(0).lessThan(1),
|
|
252
|
+
scaleUpStepRatio: ow_1.default.optional.number.greaterThan(0).lessThan(1),
|
|
253
|
+
scaleDownStepRatio: ow_1.default.optional.number.greaterThan(0).lessThan(1),
|
|
254
|
+
maybeRunIntervalSecs: ow_1.default.optional.number.greaterThan(0),
|
|
255
|
+
loggingIntervalSecs: ow_1.default.any(ow_1.default.number.greaterThan(0), ow_1.default.nullOrUndefined),
|
|
256
|
+
autoscaleIntervalSecs: ow_1.default.optional.number.greaterThan(0),
|
|
257
|
+
taskTimeoutSecs: ow_1.default.optional.number.greaterThanOrEqual(0),
|
|
258
258
|
systemStatusOptions: ow_1.default.optional.object,
|
|
259
259
|
snapshotterOptions: ow_1.default.optional.object,
|
|
260
260
|
log: ow_1.default.optional.object,
|
|
261
|
-
maxTasksPerMinute: ow_1.default.optional.number.integerOrInfinite.
|
|
261
|
+
maxTasksPerMinute: ow_1.default.optional.number.integerOrInfinite.greaterThanOrEqual(1),
|
|
262
262
|
}));
|
|
263
|
-
const { runTaskFunction, isFinishedFunction, isTaskReadyFunction, maxConcurrency =
|
|
263
|
+
const { runTaskFunction, isFinishedFunction, isTaskReadyFunction, maxConcurrency = 200, minConcurrency = 1, desiredConcurrency, desiredConcurrencyRatio = 0.90, scaleUpStepRatio = 0.05, scaleDownStepRatio = 0.05, maybeRunIntervalSecs = 0.5, loggingIntervalSecs = 60, taskTimeoutSecs = 0, autoscaleIntervalSecs = 10, systemStatusOptions, snapshotterOptions, log = log_1.log, maxTasksPerMinute = Infinity, } = options;
|
|
264
264
|
this.log = log.child({ prefix: 'AutoscaledPool' });
|
|
265
265
|
// Configurable properties.
|
|
266
266
|
this.desiredConcurrencyRatio = desiredConcurrencyRatio;
|
|
@@ -311,7 +311,7 @@ class AutoscaledPool {
|
|
|
311
311
|
* If you're not sure, just keep the default value and the concurrency will scale up automatically.
|
|
312
312
|
*/
|
|
313
313
|
set minConcurrency(value) {
|
|
314
|
-
(0, ow_1.default)(value, ow_1.default.number);
|
|
314
|
+
(0, ow_1.default)(value, ow_1.default.optional.number.integer.greaterThanOrEqual(1));
|
|
315
315
|
this._minConcurrency = value;
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -324,7 +324,7 @@ class AutoscaledPool {
|
|
|
324
324
|
* Sets the maximum number of tasks running in parallel.
|
|
325
325
|
*/
|
|
326
326
|
set maxConcurrency(value) {
|
|
327
|
-
(0, ow_1.default)(value, ow_1.default.number);
|
|
327
|
+
(0, ow_1.default)(value, ow_1.default.optional.number.integer.greaterThanOrEqual(1));
|
|
328
328
|
this._maxConcurrency = value;
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
@@ -339,7 +339,7 @@ class AutoscaledPool {
|
|
|
339
339
|
* in parallel if there's large enough supply of tasks.
|
|
340
340
|
*/
|
|
341
341
|
set desiredConcurrency(value) {
|
|
342
|
-
(0, ow_1.default)(value, ow_1.default.number);
|
|
342
|
+
(0, ow_1.default)(value, ow_1.default.optional.number.integer.greaterThanOrEqual(1));
|
|
343
343
|
this._desiredConcurrency = value;
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
@@ -362,7 +362,7 @@ class AutoscaledPool {
|
|
|
362
362
|
this.autoscaleInterval = (0, utilities_1.betterSetInterval)(this._autoscale, this.autoscaleIntervalMillis);
|
|
363
363
|
// This is here because if we scale down to let's say 1, then after each promise is finished
|
|
364
364
|
// this._maybeRunTask() doesn't trigger another one. So if that 1 instance gets stuck it results
|
|
365
|
-
// in the
|
|
365
|
+
// in the crawler getting stuck and even after scaling up it never triggers another promise.
|
|
366
366
|
this.maybeRunInterval = (0, utilities_1.betterSetInterval)(this._maybeRunTask, this.maybeRunIntervalMillis);
|
|
367
367
|
if (this.maxTasksPerMinute !== Infinity) {
|
|
368
368
|
// Start the interval that resets the counter of tasks per minute.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoscaled_pool.js","sourceRoot":"","sources":["../../src/autoscaling/autoscaled_pool.ts"],"names":[],"mappings":";;;;AACA,4CAAqD;AACrD,gDAA4F;AAC5F,oDAAoB;AACpB,oDAAiD;AACjD,gCAA2C;AAC3C,+CAAgE;AAChE,mDAAgF;AAsHhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAa,cAAc;IAmCvB,YACI,OAA8B,EACb,SAAS,6BAAa,CAAC,eAAe,EAAE;;;;;mBAAxC;;QApCrB;;;;;WAA0B;QAE1B,2BAA2B;QAC3B;;;;;WAAiD;QACjD;;;;;WAA0C;QAC1C;;;;;WAA4C;QAC5C;;;;;WAAgD;QAChD;;;;;WAA+C;QAC/C;;;;;WAAiD;QACjD;;;;;WAA2C;QAC3C;;;;;WAAyD;QACzD;;;;;WAA4D;QAC5D;;;;;WAA6D;QAC7D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AAE,EAAE,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC;IAC/F,CAAC;CACJ;AAtgBD,wCAsgBC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Log } from '@apify/log';
|
|
2
|
-
import { BetterIntervalID } from '@apify/utilities';
|
|
3
|
-
import { StorageClient } from '@crawlee/types';
|
|
1
|
+
import type { Log } from '@apify/log';
|
|
2
|
+
import type { BetterIntervalID } from '@apify/utilities';
|
|
3
|
+
import type { StorageClient } from '@crawlee/types';
|
|
4
4
|
import { Configuration } from '../configuration';
|
|
5
|
-
import { SystemInfo } from './system_status';
|
|
6
|
-
import { EventManager } from '../events/event_manager';
|
|
5
|
+
import type { SystemInfo } from './system_status';
|
|
6
|
+
import type { EventManager } from '../events/event_manager';
|
|
7
7
|
export interface SnapshotterOptions {
|
|
8
8
|
/**
|
|
9
9
|
* Defines the interval of measuring the event loop response time.
|
|
@@ -87,7 +87,7 @@ declare type ClientSnapshot = {
|
|
|
87
87
|
* Memory becomes overloaded if its current use exceeds the `maxUsedMemoryRatio` option.
|
|
88
88
|
* It's computed using the total memory available to the container when running on
|
|
89
89
|
* the Apify platform and a quarter of total system memory when running locally.
|
|
90
|
-
* Max total memory when running locally may be overridden by using the `
|
|
90
|
+
* Max total memory when running locally may be overridden by using the `CRAWLEE_MEMORY_MBYTES`
|
|
91
91
|
* environment variable.
|
|
92
92
|
*
|
|
93
93
|
* Event loop becomes overloaded if it slows down by more than the `maxBlockedMillis` option.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotter.d.ts","sourceRoot":"","sources":["../../src/autoscaling/snapshotter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"snapshotter.d.ts","sourceRoot":"","sources":["../../src/autoscaling/snapshotter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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eAAe,CAAC,oBAAoB,CAAC,EAAE,MAAM;IAI7C;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,CAAC,SAAS;QAAE,SAAS,EAAE,IAAI,CAAA;KAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE;IAoBvG;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,UAAU,EAAE,UAAU;IAchD;;OAEG;IACH,SAAS,CAAC,sBAAsB,CAAC,UAAU,EAAE,UAAU;IAmBvD;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,OAAO;IAuB5D;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU;IAY7C;;;;;;;OAOG;IACH,SAAS,CAAC,eAAe,CAAC,gBAAgB,EAAE,MAAM,OAAO;IAwBzD;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,WAAW,EAAE,GAAG,iBAAiB,EAAE,GAAG,cAAc,EAAE,EAAE,GAAG,EAAE,IAAI;IAUzH;;OAEG;YACW,cAAc;CAG/B"}
|
|
@@ -26,7 +26,7 @@ const CRITICAL_OVERLOAD_RATE_LIMIT_MILLIS = 10000;
|
|
|
26
26
|
* Memory becomes overloaded if its current use exceeds the `maxUsedMemoryRatio` option.
|
|
27
27
|
* It's computed using the total memory available to the container when running on
|
|
28
28
|
* the Apify platform and a quarter of total system memory when running locally.
|
|
29
|
-
* Max total memory when running locally may be overridden by using the `
|
|
29
|
+
* Max total memory when running locally may be overridden by using the `CRAWLEE_MEMORY_MBYTES`
|
|
30
30
|
* environment variable.
|
|
31
31
|
*
|
|
32
32
|
* Event loop becomes overloaded if it slows down by more than the `maxBlockedMillis` option.
|
|
@@ -178,11 +178,16 @@ class Snapshotter {
|
|
|
178
178
|
* Starts capturing snapshots at configured intervals.
|
|
179
179
|
*/
|
|
180
180
|
async start() {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
const memoryMbytes = this.config.get('memoryMbytes', 0);
|
|
182
|
+
if (memoryMbytes > 0) {
|
|
183
|
+
this.maxMemoryBytes = memoryMbytes * 1024 * 1024;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const { totalBytes } = await this._getMemoryInfo();
|
|
187
|
+
this.maxMemoryBytes = Math.ceil(totalBytes * this.config.get('availableMemoryRatio'));
|
|
188
|
+
this.log.debug(`Setting max memory of this run to ${Math.round(this.maxMemoryBytes / 1024 / 1024)} MB. `
|
|
189
|
+
+ 'Use the CRAWLEE_MEMORY_MBYTES or CRAWLEE_AVAILABLE_MEMORY_RATIO environment variable to override it.');
|
|
190
|
+
}
|
|
186
191
|
// Start snapshotting.
|
|
187
192
|
this.eventLoopInterval = (0, utilities_1.betterSetInterval)(this._snapshotEventLoop.bind(this), this.eventLoopSnapshotIntervalMillis);
|
|
188
193
|
this.clientInterval = (0, utilities_1.betterSetInterval)(this._snapshotClient.bind(this), this.clientSnapshotIntervalMillis);
|
|
@@ -199,7 +204,6 @@ class Snapshotter {
|
|
|
199
204
|
this.events.off("systemInfo" /* EventType.SYSTEM_INFO */, this._snapshotMemory);
|
|
200
205
|
// Allow microtask queue to unwind before stop returns.
|
|
201
206
|
await new Promise((resolve) => setImmediate(resolve));
|
|
202
|
-
// await this.events.close();
|
|
203
207
|
}
|
|
204
208
|
/**
|
|
205
209
|
* Returns a sample of latest memory snapshots, with the size of the sample defined
|
|
@@ -283,7 +287,7 @@ class Snapshotter {
|
|
|
283
287
|
const usedPercentage = Math.round((memCurrentBytes / this.maxMemoryBytes) * 100);
|
|
284
288
|
const toMb = (bytes) => Math.round(bytes / (1024 ** 2));
|
|
285
289
|
this.log.warning('Memory is critically overloaded. '
|
|
286
|
-
+ `Using ${toMb(memCurrentBytes)} MB of ${toMb(this.maxMemoryBytes)} MB (${usedPercentage}%). Consider increasing
|
|
290
|
+
+ `Using ${toMb(memCurrentBytes)} MB of ${toMb(this.maxMemoryBytes)} MB (${usedPercentage}%). Consider increasing available memory.`);
|
|
287
291
|
this.lastLoggedCriticalMemoryOverloadAt = createdAt;
|
|
288
292
|
}
|
|
289
293
|
}
|