@crawlee/cheerio 3.0.0-beta.72 → 3.0.0-beta.75
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 +30 -37
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
|
-
<a href="https://
|
|
2
|
+
<a href="https://crawlee.dev">
|
|
3
3
|
<picture>
|
|
4
4
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/apify/apify-ts/master/website/static/img/crawlee-dark.svg?sanitize=true">
|
|
5
5
|
<img alt="Crawlee" src="https://raw.githubusercontent.com/apify/apify-ts/master/website/static/img/crawlee-light.svg?sanitize=true" width="500">
|
|
@@ -16,16 +16,9 @@
|
|
|
16
16
|
<a href="https://github.com/apify/apify-ts/actions/workflows/test-and-release.yml"><img src="https://github.com/apify/apify-ts/actions/workflows/test-and-release.yml/badge.svg?branch=master" alt="Build Status" style="max-width: 100%;"></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
Crawlee simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.
|
|
20
|
-
It provides tools to manage and automatically scale a pool of headless browsers,
|
|
21
|
-
to maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,
|
|
22
|
-
rotate proxies and much more.
|
|
23
|
-
Crawlee is available as the [`crawlee`](https://www.npmjs.com/package/crawlee) NPM package.
|
|
24
|
-
It can be used either stand-alone in your own applications
|
|
25
|
-
or in [actors](https://docs.apify.com/actor)
|
|
26
|
-
running on the [Apify Cloud](https://apify.com/).
|
|
19
|
+
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/).
|
|
27
20
|
|
|
28
|
-
**View full documentation, guides and examples on the [Crawlee project website](https://
|
|
21
|
+
**View full documentation, guides and examples on the [Crawlee project website](https://crawlee.dev)**
|
|
29
22
|
|
|
30
23
|
> Would you like to work with us on Crawlee or similar projects? [We are hiring!](https://apify.com/jobs#senior-node.js-engineer)
|
|
31
24
|
|
|
@@ -46,29 +39,29 @@ The goal of Crawlee is to fill this gap and provide a toolbox for generic web sc
|
|
|
46
39
|
|
|
47
40
|
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:
|
|
48
41
|
|
|
49
|
-
- [`CheerioCrawler`](https://
|
|
42
|
+
- [`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.
|
|
50
43
|
|
|
51
|
-
- [`PuppeteerCrawler`](https://
|
|
44
|
+
- [`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.
|
|
52
45
|
|
|
53
|
-
- [`PlaywrightCrawler`](https://
|
|
46
|
+
- [`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.
|
|
54
47
|
|
|
55
|
-
- [`BasicCrawler`](https://
|
|
48
|
+
- [`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.
|
|
56
49
|
|
|
57
|
-
- [`RequestList`](https://
|
|
50
|
+
- [`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.
|
|
58
51
|
|
|
59
|
-
- [`RequestQueue`](https://
|
|
52
|
+
- [`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.
|
|
60
53
|
|
|
61
|
-
- [`Dataset`](https://
|
|
54
|
+
- [`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.
|
|
62
55
|
|
|
63
|
-
- [`KeyValueStore`](https://
|
|
56
|
+
- [`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.
|
|
64
57
|
|
|
65
|
-
- [`AutoscaledPool`](https://
|
|
58
|
+
- [`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.
|
|
66
59
|
|
|
67
|
-
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://
|
|
60
|
+
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).
|
|
68
61
|
|
|
69
62
|
## Quick Start
|
|
70
63
|
|
|
71
|
-
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://
|
|
64
|
+
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.
|
|
72
65
|
|
|
73
66
|
### Local stand-alone usage
|
|
74
67
|
|
|
@@ -80,32 +73,32 @@ npm install crawlee playwright
|
|
|
80
73
|
|
|
81
74
|
> 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.
|
|
82
75
|
|
|
83
|
-
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://
|
|
76
|
+
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).
|
|
84
77
|
|
|
85
78
|
```javascript
|
|
86
|
-
import { PlaywrightCrawler } from 'crawlee';
|
|
79
|
+
import { PlaywrightCrawler, Dataset } from 'crawlee';
|
|
87
80
|
|
|
88
|
-
const crawler = new PlaywrightCrawler(
|
|
89
|
-
async requestHandler({ request, page, enqueueLinks }) {
|
|
90
|
-
// Extract HTML title of the page.
|
|
91
|
-
const title = await page.title();
|
|
92
|
-
console.log(`Title of ${request.url}: ${title}`);
|
|
81
|
+
const crawler = new PlaywrightCrawler();
|
|
93
82
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
83
|
+
crawler.router.addDefaultHandler(async ({ request, page, enqueueLinks }) => {
|
|
84
|
+
const title = await page.title();
|
|
85
|
+
console.log(`Title of ${request.loadedUrl} is '${title}'`);
|
|
86
|
+
|
|
87
|
+
// save some results
|
|
88
|
+
await Dataset.pushData({ title, url: request.loadedUrl });
|
|
89
|
+
|
|
90
|
+
// enqueue all links targeting the same hostname
|
|
91
|
+
await enqueueLinks();
|
|
97
92
|
});
|
|
98
93
|
|
|
99
|
-
|
|
100
|
-
await crawler.addRequests(['https://www.iana.org/']);
|
|
101
|
-
await crawler.run();
|
|
94
|
+
await crawler.run(['https://www.iana.org/']);
|
|
102
95
|
```
|
|
103
96
|
|
|
104
97
|
When you run the example, you should see Crawlee automating a Chrome browser.
|
|
105
98
|
|
|
106
|
-

|
|
107
100
|
|
|
108
|
-
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://
|
|
101
|
+
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).
|
|
109
102
|
|
|
110
103
|
### Local usage with Crawlee command-line interface (CLI)
|
|
111
104
|
|
|
@@ -146,7 +139,7 @@ apify push
|
|
|
146
139
|
Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the
|
|
147
140
|
[Apify Actor](https://docs.apify.com/cli) documentation.
|
|
148
141
|
|
|
149
|
-
You can also develop your web scraping project in an online code editor directly on the [Apify platform](https://
|
|
142
|
+
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.
|
|
150
143
|
|
|
151
144
|
For more information, view the [Apify actors quick start guide](https://docs.apify.com/actor/quick-start).
|
|
152
145
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/cheerio",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.75",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.0.0"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"bugs": {
|
|
43
43
|
"url": "https://github.com/apify/apify-ts/issues"
|
|
44
44
|
},
|
|
45
|
-
"homepage": "https://
|
|
45
|
+
"homepage": "https://crawlee.dev",
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "npm run clean && npm run compile && npm run copy",
|
|
48
48
|
"clean": "rimraf ./dist",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@apify/timeout": "^0.3.0",
|
|
57
57
|
"@apify/utilities": "^2.0.0",
|
|
58
|
-
"@crawlee/basic": "^3.0.0-beta.
|
|
58
|
+
"@crawlee/basic": "^3.0.0-beta.75",
|
|
59
59
|
"@types/content-type": "^1.1.5",
|
|
60
60
|
"content-type": "^1.0.4",
|
|
61
61
|
"cheerio": "1.0.0-rc.11",
|