@crawlee/cheerio 3.3.4-beta.15 → 3.3.4-beta.17
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 +107 -35
- package/package.json +18 -11
package/README.md
CHANGED
|
@@ -1,55 +1,127 @@
|
|
|
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>A web scraping and browser automation library</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.svg" alt="NPM latest 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
|
-
|
|
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. ℹ️
|
|
6
20
|
|
|
7
|
-
|
|
21
|
+
Crawlee covers your crawling and scraping end-to-end and **helps you build reliable scrapers. Fast.**
|
|
8
22
|
|
|
9
|
-
|
|
23
|
+
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.
|
|
10
24
|
|
|
11
|
-
|
|
25
|
+
Crawlee is available as the [`crawlee`](https://www.npmjs.com/package/crawlee) NPM package.
|
|
12
26
|
|
|
13
|
-
|
|
27
|
+
> 👉 **View full documentation, guides and examples on the [Crawlee project website](https://crawlee.dev)** 👈
|
|
14
28
|
|
|
15
|
-
|
|
29
|
+
## Installation
|
|
16
30
|
|
|
31
|
+
We recommend visiting the [Introduction tutorial](https://crawlee.dev/docs/introduction) in Crawlee documentation for more information.
|
|
32
|
+
|
|
33
|
+
> Crawlee requires **Node.js 16 or higher**.
|
|
34
|
+
|
|
35
|
+
### With Crawlee CLI
|
|
36
|
+
|
|
37
|
+
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.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx crawlee create my-crawler
|
|
17
41
|
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cd my-crawler
|
|
45
|
+
npm start
|
|
23
46
|
```
|
|
24
47
|
|
|
25
|
-
|
|
48
|
+
### Manual installation
|
|
49
|
+
If you prefer adding Crawlee **into your own project**, try the example below. Because it uses `PlaywrightCrawler` we also need to install [Playwright](https://playwright.dev). It's not bundled with Crawlee to reduce install size.
|
|
26
50
|
|
|
27
|
-
|
|
51
|
+
```bash
|
|
52
|
+
npm install crawlee playwright
|
|
53
|
+
```
|
|
28
54
|
|
|
29
|
-
|
|
55
|
+
```js
|
|
56
|
+
import { PlaywrightCrawler, Dataset } from 'crawlee';
|
|
30
57
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
// PlaywrightCrawler crawls the web using a headless
|
|
59
|
+
// browser controlled by the Playwright library.
|
|
60
|
+
const crawler = new PlaywrightCrawler({
|
|
61
|
+
// Use the requestHandler to process each of the crawled pages.
|
|
62
|
+
async requestHandler({ request, page, enqueueLinks, log }) {
|
|
63
|
+
const title = await page.title();
|
|
64
|
+
log.info(`Title of ${request.loadedUrl} is '${title}'`);
|
|
36
65
|
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
data.push({ title: $(el).find('.some-title').text() });
|
|
40
|
-
});
|
|
66
|
+
// Save results as JSON to ./storage/datasets/default
|
|
67
|
+
await Dataset.pushData({ title, url: request.loadedUrl });
|
|
41
68
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
html: body,
|
|
46
|
-
data,
|
|
47
|
-
})
|
|
69
|
+
// Extract links from the current page
|
|
70
|
+
// and add them to the crawling queue.
|
|
71
|
+
await enqueueLinks();
|
|
48
72
|
},
|
|
73
|
+
// Uncomment this option to see the browser window.
|
|
74
|
+
// headless: false,
|
|
49
75
|
});
|
|
50
76
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
'http://www.example.com/page-2',
|
|
54
|
-
]);
|
|
77
|
+
// Add first URL to the queue and start the crawl.
|
|
78
|
+
await crawler.run(['https://crawlee.dev']);
|
|
55
79
|
```
|
|
80
|
+
|
|
81
|
+
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](https://crawlee.dev/docs/guides/configuration), [Request storage](https://crawlee.dev/docs/guides/request-storage) and [Result storage](https://crawlee.dev/docs/guides/result-storage).
|
|
82
|
+
|
|
83
|
+
## 🛠 Features
|
|
84
|
+
|
|
85
|
+
- Single interface for **HTTP and headless browser** crawling
|
|
86
|
+
- Persistent **queue** for URLs to crawl (breadth & depth first)
|
|
87
|
+
- Pluggable **storage** of both tabular data and files
|
|
88
|
+
- Automatic **scaling** with available system resources
|
|
89
|
+
- Integrated **proxy rotation** and session management
|
|
90
|
+
- Lifecycles customizable with **hooks**
|
|
91
|
+
- **CLI** to bootstrap your projects
|
|
92
|
+
- Configurable **routing**, **error handling** and **retries**
|
|
93
|
+
- **Dockerfiles** ready to deploy
|
|
94
|
+
- Written in **TypeScript** with generics
|
|
95
|
+
|
|
96
|
+
### 👾 HTTP crawling
|
|
97
|
+
|
|
98
|
+
- Zero config **HTTP2 support**, even for proxies
|
|
99
|
+
- Automatic generation of **browser-like headers**
|
|
100
|
+
- Replication of browser **TLS fingerprints**
|
|
101
|
+
- Integrated fast **HTML parsers**. Cheerio and JSDOM
|
|
102
|
+
- Yes, you can scrape **JSON APIs** as well
|
|
103
|
+
|
|
104
|
+
### 💻 Real browser crawling
|
|
105
|
+
|
|
106
|
+
- JavaScript **rendering** and **screenshots**
|
|
107
|
+
- **Headless** and **headful** support
|
|
108
|
+
- Zero-config generation of **human-like fingerprints**
|
|
109
|
+
- Automatic **browser management**
|
|
110
|
+
- Use **Playwright** and **Puppeteer** with the same interface
|
|
111
|
+
- **Chrome**, **Firefox**, **Webkit** and many others
|
|
112
|
+
|
|
113
|
+
## Usage on the Apify platform
|
|
114
|
+
|
|
115
|
+
Crawlee is open-source and runs anywhere, but since it's developed by [Apify](https://apify.com), it's easy to set up on the Apify platform and run in the cloud. Visit the [Apify SDK website](https://sdk.apify.com) to learn more about deploying Crawlee to the Apify platform.
|
|
116
|
+
|
|
117
|
+
## Support
|
|
118
|
+
|
|
119
|
+
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), in GitHub Discussions or you can join our [Discord server](https://discord.com/invite/jyEM2PRvMU).
|
|
120
|
+
|
|
121
|
+
## Contributing
|
|
122
|
+
|
|
123
|
+
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).
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
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.
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/cheerio",
|
|
3
|
-
"version": "3.3.4-beta.
|
|
3
|
+
"version": "3.3.4-beta.17",
|
|
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"
|
|
7
7
|
},
|
|
8
|
-
"main": "./
|
|
9
|
-
"module": "./
|
|
10
|
-
"types": "./
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"module": "./index.mjs",
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"import": "./
|
|
14
|
-
"require": "./
|
|
15
|
-
"types": "./
|
|
13
|
+
"import": "./index.mjs",
|
|
14
|
+
"require": "./index.js",
|
|
15
|
+
"types": "./index.d.ts"
|
|
16
16
|
},
|
|
17
17
|
"./package.json": "./package.json"
|
|
18
18
|
},
|
|
@@ -46,18 +46,25 @@
|
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "yarn clean && yarn compile && yarn copy",
|
|
48
48
|
"clean": "rimraf ./dist",
|
|
49
|
-
"compile": "tsc -p tsconfig.build.json && gen-esm-wrapper ./
|
|
49
|
+
"compile": "tsc -p tsconfig.build.json && gen-esm-wrapper ./index.js ./index.mjs",
|
|
50
50
|
"copy": "ts-node -T ../../scripts/copy.ts"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@crawlee/http": "^3.3.4-beta.
|
|
57
|
-
"@crawlee/types": "^3.3.4-beta.
|
|
56
|
+
"@crawlee/http": "^3.3.4-beta.17",
|
|
57
|
+
"@crawlee/types": "^3.3.4-beta.17",
|
|
58
58
|
"cheerio": "^1.0.0-rc.12",
|
|
59
59
|
"htmlparser2": "^9.0.0",
|
|
60
60
|
"tslib": "^2.4.0"
|
|
61
61
|
},
|
|
62
|
-
"
|
|
62
|
+
"lerna": {
|
|
63
|
+
"command": {
|
|
64
|
+
"publish": {
|
|
65
|
+
"assets": []
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"gitHead": "8bbc596f4dba0aa755df204d836c97c05fc94fca"
|
|
63
70
|
}
|