@crawlee/utils 3.0.0-beta.5 → 3.0.0-beta.52
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 +67 -71
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/internals/cheerio.d.ts +2 -2
- package/internals/cheerio.d.ts.map +1 -1
- package/internals/cheerio.js +1 -1
- package/internals/cheerio.js.map +1 -1
- package/internals/debug.d.ts +32 -0
- package/internals/debug.d.ts.map +1 -0
- package/internals/debug.js +32 -0
- package/internals/debug.js.map +1 -0
- package/internals/extract-urls.d.ts +1 -1
- package/internals/general.d.ts +1 -1
- package/internals/general.js +1 -1
- package/internals/memory-info.js.map +1 -1
- package/internals/social.d.ts +18 -19
- package/internals/social.d.ts.map +1 -1
- package/internals/social.js +18 -20
- package/internals/social.js.map +1 -1
- package/internals/typedefs.d.ts +0 -6
- package/internals/typedefs.d.ts.map +1 -1
- package/internals/typedefs.js.map +1 -1
- package/package.json +12 -9
- package/tsconfig.build.tsbuildinfo +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<a href="https://apify.github.io/apify-ts/">
|
|
3
|
+
<picture>
|
|
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
|
+
<img alt="Crawlee" src="https://raw.githubusercontent.com/apify/apify-ts/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>
|
|
11
|
+
|
|
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/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
|
+
</p>
|
|
18
|
+
|
|
19
|
+
Crawlee simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.
|
|
11
20
|
It provides tools to manage and automatically scale a pool of headless browsers,
|
|
12
21
|
to maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,
|
|
13
22
|
rotate proxies and much more.
|
|
14
|
-
The SDK is available as the [`
|
|
23
|
+
The SDK is available as the [`crawlee`](https://www.npmjs.com/package/crawlee) NPM package.
|
|
15
24
|
It can be used either stand-alone in your own applications
|
|
16
25
|
or in [actors](https://docs.apify.com/actor)
|
|
17
26
|
running on the [Apify Cloud](https://apify.com/).
|
|
18
27
|
|
|
19
|
-
**View full documentation, guides and examples on the [
|
|
28
|
+
**View full documentation, guides and examples on the [Crawlee project website](https://apify.github.io/apify-ts/)**
|
|
20
29
|
|
|
21
|
-
> Would you like to work with us on
|
|
30
|
+
> Would you like to work with us on Crawlee or similar projects? [We are hiring!](https://apify.com/jobs#senior-node.js-engineer)
|
|
22
31
|
|
|
23
32
|
## Motivation
|
|
24
33
|
|
|
@@ -35,119 +44,106 @@ Python has [Scrapy](https://scrapy.org/) for these tasks, but there was no such
|
|
|
35
44
|
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
45
|
browser.
|
|
37
46
|
|
|
38
|
-
The goal of
|
|
47
|
+
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
|
|
39
48
|
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
49
|
commonalities.
|
|
41
50
|
|
|
42
51
|
## Overview
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
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:
|
|
54
|
+
|
|
55
|
+
[//]: # (TODO add links to the docs about `@crawlee/` packages and the `crawlee` metapackage)
|
|
45
56
|
|
|
46
|
-
- [`CheerioCrawler`](https://
|
|
57
|
+
- [`CheerioCrawler`](https://apify.github.io/apify-ts/api/cheerio-crawler/class/CheerioCrawler) - Enables the parallel crawling of a large
|
|
47
58
|
number of web pages using the [cheerio](https://www.npmjs.com/package/cheerio) HTML parser. This is the most
|
|
48
59
|
efficient web crawler, but it does not work on websites that require JavaScript.
|
|
49
60
|
|
|
50
|
-
- [`PuppeteerCrawler`](https://
|
|
61
|
+
- [`PuppeteerCrawler`](https://apify.github.io/apify-ts/api/puppeteer-crawler/class/PuppeteerCrawler) - Enables the parallel crawling of
|
|
51
62
|
a large number of web pages using the headless Chrome browser and [Puppeteer](https://github.com/puppeteer/puppeteer).
|
|
52
63
|
The pool of Chrome browsers is automatically scaled up and down based on available system resources.
|
|
53
64
|
|
|
54
|
-
- [`PlaywrightCrawler`](https://
|
|
65
|
+
- [`PlaywrightCrawler`](https://apify.github.io/apify-ts/api/playwright-crawler/class/PlaywrightCrawler) - Unlike `PuppeteerCrawler`
|
|
55
66
|
you can use [Playwright](https://github.com/microsoft/playwright) to manage almost any headless browser.
|
|
56
67
|
It also provides a cleaner and more mature interface while keeping the ease of use and advanced features.
|
|
57
68
|
|
|
58
|
-
- [`BasicCrawler`](https://
|
|
69
|
+
- [`BasicCrawler`](https://apify.github.io/apify-ts/api/basic-crawler/class/BasicCrawler) - Provides a simple framework for the parallel
|
|
59
70
|
crawling of web pages whose URLs are fed either from a static list or from a dynamic queue of URLs. This class
|
|
60
71
|
serves as a base for the more specialized crawlers above.
|
|
61
72
|
|
|
62
|
-
- [`RequestList`](https://
|
|
73
|
+
- [`RequestList`](https://apify.github.io/apify-ts/api/core/class/RequestList) - Represents a list of URLs to crawl.
|
|
63
74
|
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
75
|
can resume when the Node.js process restarts.
|
|
65
76
|
|
|
66
|
-
- [`RequestQueue`](https://
|
|
77
|
+
- [`RequestQueue`](https://apify.github.io/apify-ts/api/core/class/RequestQueue) - Represents a queue of URLs to crawl,
|
|
67
78
|
which is stored either on a local filesystem or in the [Apify Cloud](https://apify.com). The queue is used
|
|
68
79
|
for deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.
|
|
69
80
|
The data structure supports both breadth-first and depth-first crawling orders.
|
|
70
81
|
|
|
71
|
-
- [`Dataset`](https://
|
|
82
|
+
- [`Dataset`](https://apify.github.io/apify-ts/api/core/class/Dataset) - Provides a store for structured data and enables their export
|
|
72
83
|
to formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.
|
|
73
84
|
Datasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.
|
|
74
85
|
|
|
75
|
-
- [`KeyValueStore`](https://
|
|
86
|
+
- [`KeyValueStore`](https://apify.github.io/apify-ts/api/core/class/KeyValueStore) - A simple key-value store for arbitrary data
|
|
76
87
|
records or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs
|
|
77
88
|
or to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud.
|
|
78
89
|
|
|
79
|
-
- [`AutoscaledPool`](https://
|
|
90
|
+
- [`AutoscaledPool`](https://apify.github.io/apify-ts/api/core/class/AutoscaledPool) - Runs asynchronous background tasks,
|
|
80
91
|
while automatically adjusting the concurrency based on free system memory and CPU usage. This is useful for running
|
|
81
92
|
web scraping tasks at the maximum capacity of the system.
|
|
82
93
|
|
|
83
|
-
- [`Browser Utils`](https://sdk.apify.com/docs/api/puppeteer) - Provides several helper functions useful
|
|
84
|
-
for web scraping. For example, to inject jQuery into web pages or to hide browser origin.
|
|
85
|
-
|
|
86
94
|
Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus
|
|
87
95
|
take advantage of its pool of proxies, job scheduler, data storage, etc.
|
|
88
|
-
For more information, see the [
|
|
96
|
+
For more information, see the [Crawlee Programmer's Reference](https://apify.github.io/apify-ts/).
|
|
89
97
|
|
|
90
98
|
## Quick Start
|
|
91
99
|
|
|
92
|
-
This short tutorial will set you up to start using
|
|
93
|
-
If you want to learn more, proceed to the [Getting Started](https://
|
|
100
|
+
This short tutorial will set you up to start using Crawlee in a minute or two.
|
|
101
|
+
If you want to learn more, proceed to the [Getting Started](https://apify.github.io/apify-ts/docs/guides/getting-started)
|
|
94
102
|
tutorial that will take you step by step through creating your first scraper.
|
|
95
103
|
|
|
96
104
|
### Local stand-alone usage
|
|
97
105
|
|
|
98
|
-
|
|
99
|
-
Add
|
|
106
|
+
Crawlee requires [Node.js](https://nodejs.org/en/) 16 or later.
|
|
107
|
+
Add Crawlee to any Node.js project by running:
|
|
100
108
|
|
|
101
109
|
```bash
|
|
102
|
-
npm install
|
|
110
|
+
npm install @crawlee/playwright playwright
|
|
103
111
|
```
|
|
104
112
|
|
|
105
|
-
> Neither `playwright` nor `puppeteer` are bundled with the SDK to reduce install size and allow greater
|
|
106
|
-
> flexibility. That's why we install it with NPM. You can choose one, both, or neither.
|
|
113
|
+
> Neither `playwright` nor `puppeteer` are bundled with the SDK to reduce install size and allow greater flexibility. That's why we install it with NPM. You can choose one, both, or neither.
|
|
107
114
|
|
|
108
|
-
Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of
|
|
109
|
-
[see the Examples section of the documentation](https://
|
|
115
|
+
Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of Crawlee,
|
|
116
|
+
[see the Examples section of the documentation](https://apify.github.io/apify-ts/docs/examples/crawl-multiple-urls).
|
|
110
117
|
|
|
111
118
|
```javascript
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// Extract HTML title of the page.
|
|
124
|
-
const title = await page.title();
|
|
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();
|
|
119
|
+
import { PlaywrightCrawler } from '@crawlee/playwright';
|
|
120
|
+
|
|
121
|
+
const crawler = new PlaywrightCrawler({
|
|
122
|
+
async requestHandler({ request, page, enqueueLinks }) {
|
|
123
|
+
// Extract HTML title of the page.
|
|
124
|
+
const title = await page.title();
|
|
125
|
+
console.log(`Title of ${request.url}: ${title}`);
|
|
126
|
+
|
|
127
|
+
// Add URLs from the same subdomain.
|
|
128
|
+
await enqueueLinks();
|
|
129
|
+
},
|
|
137
130
|
});
|
|
131
|
+
|
|
132
|
+
// Choose the first URL to open and run the crawler.
|
|
133
|
+
await crawler.addRequests(['https://www.iana.org/']);
|
|
134
|
+
await crawler.run();
|
|
138
135
|
```
|
|
139
136
|
|
|
140
|
-
When you run the example, you should see
|
|
137
|
+
When you run the example, you should see Crawlee automating a Chrome browser.
|
|
141
138
|
|
|
142
|
-

|
|
143
140
|
|
|
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).
|
|
141
|
+
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://apify.github.io/apify-ts/docs/guides/environment-variables), [Request storage](https://apify.github.io/apify-ts/docs/guides/request-storage) and [Result storage](https://apify.github.io/apify-ts/docs/guides/result-storage).
|
|
146
142
|
|
|
147
143
|
### Local usage with Apify command-line interface (CLI)
|
|
148
144
|
|
|
149
145
|
To avoid the need to set the environment variables manually, to create a boilerplate of your project, and to enable pushing and running your code on
|
|
150
|
-
the [Apify platform](https://
|
|
146
|
+
the [Apify platform](https://apify.github.io/apify-ts/docs/guides/apify-platform), you can use the [Apify command-line interface (CLI)](https://github.com/apify/apify-cli) tool.
|
|
151
147
|
|
|
152
148
|
Install the CLI by running:
|
|
153
149
|
|
|
@@ -169,8 +165,8 @@ cd my-hello-world
|
|
|
169
165
|
apify run
|
|
170
166
|
```
|
|
171
167
|
|
|
172
|
-
By default, the crawling data will be stored in a local directory at `./
|
|
173
|
-
be in the default key-value store in `./
|
|
168
|
+
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
|
|
169
|
+
be in the default key-value store in `./crawlee_storage/key_value_stores/default/INPUT.json`.
|
|
174
170
|
|
|
175
171
|
Now you can easily deploy your code to the Apify platform by running:
|
|
176
172
|
|
|
@@ -187,7 +183,7 @@ Your script will be uploaded to the Apify platform and built there so that it ca
|
|
|
187
183
|
|
|
188
184
|
### Usage on the Apify platform
|
|
189
185
|
|
|
190
|
-
You can also develop your web scraping project in an online code editor directly on the [Apify platform](https://
|
|
186
|
+
You can also develop your web scraping project in an online code editor directly on the [Apify platform](https://apify.github.io/apify-ts/docs/guides/apify-platform).
|
|
191
187
|
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
188
|
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
189
|
|
|
@@ -195,7 +191,7 @@ For more information, view the [Apify actors quick start guide](https://docs.api
|
|
|
195
191
|
|
|
196
192
|
## Support
|
|
197
193
|
|
|
198
|
-
If you find any bug or issue with
|
|
194
|
+
If you find any bug or issue with Crawlee, please [submit an issue on GitHub](https://github.com/apify/apify-js/issues).
|
|
199
195
|
For questions, you can ask on [Stack Overflow](https://stackoverflow.com/questions/tagged/apify) or contact support@apify.com
|
|
200
196
|
|
|
201
197
|
## Contributing
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './internals/chunk';
|
|
|
3
3
|
export * from './internals/extract-urls';
|
|
4
4
|
export * from './internals/general';
|
|
5
5
|
export * from './internals/memory-info';
|
|
6
|
+
export * from './internals/debug';
|
|
6
7
|
export * as social from './internals/social';
|
|
7
8
|
export * from './internals/typedefs';
|
|
9
|
+
export { Dictionary, Awaitable, Constructor } from '@crawlee/types';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./internals/chunk"), exports);
|
|
|
7
7
|
tslib_1.__exportStar(require("./internals/extract-urls"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./internals/general"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./internals/memory-info"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./internals/debug"), exports);
|
|
10
11
|
exports.social = tslib_1.__importStar(require("./internals/social"));
|
|
11
12
|
tslib_1.__exportStar(require("./internals/typedefs"), exports);
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,8DAAoC;AACpC,4DAAkC;AAClC,mEAAyC;AACzC,8DAAoC;AACpC,kEAAwC;AACxC,qEAA6C;AAC7C,+DAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,8DAAoC;AACpC,4DAAkC;AAClC,mEAAyC;AACzC,8DAAoC;AACpC,kEAAwC;AACxC,4DAAkC;AAClC,qEAA6C;AAC7C,+DAAqC"}
|
package/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ export default mod;
|
|
|
4
4
|
export const URL_NO_COMMAS_REGEX = mod.URL_NO_COMMAS_REGEX;
|
|
5
5
|
export const URL_WITH_COMMAS_REGEX = mod.URL_WITH_COMMAS_REGEX;
|
|
6
6
|
export const chunk = mod.chunk;
|
|
7
|
+
export const createRequestDebugInfo = mod.createRequestDebugInfo;
|
|
7
8
|
export const downloadListOfUrls = mod.downloadListOfUrls;
|
|
8
9
|
export const entries = mod.entries;
|
|
9
10
|
export const extractUrls = mod.extractUrls;
|
package/internals/cheerio.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { load } from 'cheerio';
|
|
1
|
+
import type { load } from 'cheerio';
|
|
2
2
|
export declare type CheerioRoot = ReturnType<typeof load>;
|
|
3
3
|
/**
|
|
4
4
|
* The function converts a HTML document to a plain text.
|
|
@@ -21,7 +21,7 @@ export declare type CheerioRoot = ReturnType<typeof load>;
|
|
|
21
21
|
* with the `decodeEntities` option set to `true`. For example:
|
|
22
22
|
*
|
|
23
23
|
* ```javascript
|
|
24
|
-
*
|
|
24
|
+
* import cheerio from 'cheerio';
|
|
25
25
|
* const html = '<html><body>Some text</body></html>';
|
|
26
26
|
* const text = htmlToText(cheerio.load(html, { decodeEntities: true }));
|
|
27
27
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheerio.d.ts","sourceRoot":"","sources":["../../src/internals/cheerio.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"cheerio.d.ts","sourceRoot":"","sources":["../../src/internals/cheerio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC,oBAAY,WAAW,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AAMlD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,UAAU,CAAC,oBAAoB,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAiD7E"}
|
package/internals/cheerio.js
CHANGED
|
@@ -27,7 +27,7 @@ const BLOCK_TAGS_REGEX = /^(p|h1|h2|h3|h4|h5|h6|ol|ul|li|pre|address|blockquote|
|
|
|
27
27
|
* with the `decodeEntities` option set to `true`. For example:
|
|
28
28
|
*
|
|
29
29
|
* ```javascript
|
|
30
|
-
*
|
|
30
|
+
* import cheerio from 'cheerio';
|
|
31
31
|
* const html = '<html><body>Some text</body></html>';
|
|
32
32
|
* const text = htmlToText(cheerio.load(html, { decodeEntities: true }));
|
|
33
33
|
* ```
|
package/internals/cheerio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cheerio.js","sourceRoot":"","sources":["../../src/internals/cheerio.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"cheerio.js","sourceRoot":"","sources":["../../src/internals/cheerio.ts"],"names":[],"mappings":";;;;AACA,8DAA8B;AAI9B,gIAAgI;AAChI,MAAM,eAAe,GAAG,uCAAuC,CAAC;AAChE,MAAM,gBAAgB,GAAG,sGAAsG,CAAC;AAEhI;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,UAAU,CAAC,oBAA0C;IACjE,IAAI,CAAC,oBAAoB;QAAE,OAAO,EAAE,CAAC;IAErC,+EAA+E;IAC/E,qEAAqE;IACrE,+EAA+E;IAC/E,oGAAoG;IACpG,iDAAiD;IACjD,MAAM,CAAC,GAAG,OAAO,oBAAoB,KAAK,UAAU,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,iBAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3I,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,0DAA0D;IAC1D,6GAA6G;IAC7G,wEAAwE;IACxE,mBAAmB;IACnB,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;QACtB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,KAAK,IAAI,CAAC,G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B,IAAI,UAAU,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAAE,IAAI,IAAI,IAAI,CAAC;aACxD;SACJ;IACL,CAAC,CAAC;IAEF,kFAAkF;IAClF,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAE7C,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAjDD,gCAiDC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { IncomingMessage } from 'node:http';
|
|
3
|
+
import type { Dictionary, AllowedHttpMethods } from '@crawlee/types';
|
|
4
|
+
interface BrowserResponseLike {
|
|
5
|
+
status(): number;
|
|
6
|
+
}
|
|
7
|
+
interface Request<UserData extends Dictionary = Dictionary> {
|
|
8
|
+
id?: string;
|
|
9
|
+
url: string;
|
|
10
|
+
loadedUrl?: string;
|
|
11
|
+
uniqueKey: string;
|
|
12
|
+
method: AllowedHttpMethods;
|
|
13
|
+
payload?: string;
|
|
14
|
+
noRetry: boolean;
|
|
15
|
+
retryCount: number;
|
|
16
|
+
errorMessages: string[];
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
userData: UserData;
|
|
19
|
+
handledAt?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a standardized debug info from request and response. This info is usually added to dataset under the hidden `#debug` field.
|
|
23
|
+
*
|
|
24
|
+
* @param request [Request](https://sdk.apify.com/docs/api/request) object.
|
|
25
|
+
* @param [response]
|
|
26
|
+
* Puppeteer [`Response`](https://pptr.dev/#?product=Puppeteer&version=v1.11.0&show=api-class-response)
|
|
27
|
+
* or NodeJS [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_serverresponse).
|
|
28
|
+
* @param [additionalFields] Object containing additional fields to be added.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createRequestDebugInfo(request: Request, response?: IncomingMessage | Partial<BrowserResponseLike>, additionalFields?: Dictionary): Dictionary;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/internals/debug.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGrE,UAAU,mBAAmB;IACzB,MAAM,IAAI,MAAM,CAAC;CACpB;AAED,UAAU,OAAO,CAAC,QAAQ,SAAS,UAAU,GAAG,UAAU;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,GAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAM,EAC7D,gBAAgB,GAAE,UAAe,GAClC,UAAU,CAgBZ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRequestDebugInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
6
|
+
/**
|
|
7
|
+
* Creates a standardized debug info from request and response. This info is usually added to dataset under the hidden `#debug` field.
|
|
8
|
+
*
|
|
9
|
+
* @param request [Request](https://sdk.apify.com/docs/api/request) object.
|
|
10
|
+
* @param [response]
|
|
11
|
+
* Puppeteer [`Response`](https://pptr.dev/#?product=Puppeteer&version=v1.11.0&show=api-class-response)
|
|
12
|
+
* or NodeJS [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_serverresponse).
|
|
13
|
+
* @param [additionalFields] Object containing additional fields to be added.
|
|
14
|
+
*/
|
|
15
|
+
function createRequestDebugInfo(request, response = {}, additionalFields = {}) {
|
|
16
|
+
(0, ow_1.default)(request, ow_1.default.object);
|
|
17
|
+
(0, ow_1.default)(response, ow_1.default.object);
|
|
18
|
+
(0, ow_1.default)(additionalFields, ow_1.default.object);
|
|
19
|
+
return {
|
|
20
|
+
requestId: request.id,
|
|
21
|
+
url: request.url,
|
|
22
|
+
loadedUrl: request.loadedUrl,
|
|
23
|
+
method: request.method,
|
|
24
|
+
retryCount: request.retryCount,
|
|
25
|
+
errorMessages: request.errorMessages,
|
|
26
|
+
// Puppeteer response has .status() function and NodeJS response, statusCode property.
|
|
27
|
+
statusCode: 'status' in response && response.status instanceof Function ? response.status() : response.statusCode,
|
|
28
|
+
...additionalFields,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.createRequestDebugInfo = createRequestDebugInfo;
|
|
32
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/internals/debug.ts"],"names":[],"mappings":";;;;AAEA,oDAAoB;AAqBpB;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAClC,OAAgB,EAChB,WAA2D,EAAE,EAC7D,mBAA+B,EAAE;IAEjC,IAAA,YAAE,EAAC,OAAO,EAAE,YAAE,CAAC,MAAM,CAAC,CAAC;IACvB,IAAA,YAAE,EAAC,QAAQ,EAAE,YAAE,CAAC,MAAM,CAAC,CAAC;IACxB,IAAA,YAAE,EAAC,gBAAgB,EAAE,YAAE,CAAC,MAAM,CAAC,CAAC;IAEhC,OAAO;QACH,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,sFAAsF;QACtF,UAAU,EAAE,QAAQ,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAE,QAA4B,CAAC,UAAU;QACtI,GAAG,gBAAgB;KACtB,CAAC;AACN,CAAC;AApBD,wDAoBC"}
|
|
@@ -12,7 +12,7 @@ export interface DownloadListOfUrlsOptions {
|
|
|
12
12
|
/**
|
|
13
13
|
* Custom regular expression to identify the URLs in the file to extract.
|
|
14
14
|
* The regular expression should be case-insensitive and have global flag set (i.e. `/something/gi`).
|
|
15
|
-
* @default
|
|
15
|
+
* @default URL_NO_COMMAS_REGEX
|
|
16
16
|
*/
|
|
17
17
|
urlRegExp?: RegExp;
|
|
18
18
|
}
|
package/internals/general.d.ts
CHANGED
package/internals/general.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-info.js","sourceRoot":"","sources":["../../src/internals/memory-info.ts"],"names":[],"mappings":";;;;AAAA,6DAA6B;AAC7B,6DAA6D;AAC7D,qEAAoC;
|
|
1
|
+
{"version":3,"file":"memory-info.js","sourceRoot":"","sources":["../../src/internals/memory-info.ts"],"names":[],"mappings":";;;;AAA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AS,GAAG,UAAU,GAAG,SAAS,CAAC;KACtC;IAED,OAAO;QACH,UAAU;QACV,SAAS;QACT,SAAS;QACT,gBAAgB;QAChB,mBAAmB;KACtB,CAAC;AACN,CAAC;AAnHD,sCAmHC"}
|
package/internals/social.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare function emailsFromUrls(urls: string[]): string[];
|
|
|
28
28
|
/**
|
|
29
29
|
* The function attempts to extract phone numbers from a text. Please note that
|
|
30
30
|
* the results might not be accurate, since phone numbers appear in a large variety of formats and conventions.
|
|
31
|
-
* If you encounter some problems, please [file an issue](https://github.com/apify/apify-
|
|
31
|
+
* If you encounter some problems, please [file an issue](https://github.com/apify/apify-ts/issues).
|
|
32
32
|
* @param text Text to search the phone numbers in.
|
|
33
33
|
* @return Array of phone numbers found.
|
|
34
34
|
* If no phone numbers are found, the function returns an empty array.
|
|
@@ -70,8 +70,7 @@ export interface SocialHandles {
|
|
|
70
70
|
*
|
|
71
71
|
* **Example usage:**
|
|
72
72
|
* ```typescript
|
|
73
|
-
* import { launchPuppeteer } from '
|
|
74
|
-
* import { social } from '@crawlee/utils';
|
|
73
|
+
* import { launchPuppeteer, social } from 'crawlee';
|
|
75
74
|
*
|
|
76
75
|
* const browser = await launchPuppeteer();
|
|
77
76
|
* const page = await browser.newPage();
|
|
@@ -108,7 +107,7 @@ export declare function parseHandlesFromHtml(html: string, data?: Record<string,
|
|
|
108
107
|
*
|
|
109
108
|
* Example usage:
|
|
110
109
|
* ```
|
|
111
|
-
* import { social } from '
|
|
110
|
+
* import { social } from 'crawlee';
|
|
112
111
|
*
|
|
113
112
|
* if (social.LINKEDIN_REGEX.test('https://www.linkedin.com/in/alan-turing')) {
|
|
114
113
|
* console.log('Match!');
|
|
@@ -138,7 +137,7 @@ export declare const LINKEDIN_REGEX: RegExp;
|
|
|
138
137
|
*
|
|
139
138
|
* Example usage:
|
|
140
139
|
* ```
|
|
141
|
-
* import { social } from '
|
|
140
|
+
* import { social } from 'crawlee';
|
|
142
141
|
*
|
|
143
142
|
* const matches = text.match(social.LINKEDIN_REGEX_GLOBAL);
|
|
144
143
|
* if (matches) console.log(`${matches.length} LinkedIn profiles found!`);
|
|
@@ -168,7 +167,7 @@ export declare const LINKEDIN_REGEX_GLOBAL: RegExp;
|
|
|
168
167
|
*
|
|
169
168
|
* Example usage:
|
|
170
169
|
* ```
|
|
171
|
-
* import { social } from '
|
|
170
|
+
* import { social } from 'crawlee';
|
|
172
171
|
*
|
|
173
172
|
* if (social.INSTAGRAM_REGEX.test('https://www.instagram.com/old_prague')) {
|
|
174
173
|
* console.log('Match!');
|
|
@@ -204,7 +203,7 @@ export declare const INSTAGRAM_REGEX: RegExp;
|
|
|
204
203
|
*
|
|
205
204
|
* Example usage:
|
|
206
205
|
* ```
|
|
207
|
-
* import { social } from '
|
|
206
|
+
* import { social } from 'crawlee';
|
|
208
207
|
*
|
|
209
208
|
* const matches = text.match(social.INSTAGRAM_REGEX_GLOBAL);
|
|
210
209
|
* if (matches) console.log(`${matches.length} Instagram profiles found!`);
|
|
@@ -227,7 +226,7 @@ export declare const INSTAGRAM_REGEX_GLOBAL: RegExp;
|
|
|
227
226
|
*
|
|
228
227
|
* Example usage:
|
|
229
228
|
* ```
|
|
230
|
-
* import { social } from '
|
|
229
|
+
* import { social } from 'crawlee';
|
|
231
230
|
*
|
|
232
231
|
* if (social.TWITTER_REGEX.test('https://www.twitter.com/apify')) {
|
|
233
232
|
* console.log('Match!');
|
|
@@ -255,7 +254,7 @@ export declare const TWITTER_REGEX: RegExp;
|
|
|
255
254
|
*
|
|
256
255
|
* Example usage:
|
|
257
256
|
* ```
|
|
258
|
-
* import { social } from '
|
|
257
|
+
* import { social } from 'crawlee';
|
|
259
258
|
*
|
|
260
259
|
* const matches = text.match(social.TWITTER_REGEX_STRING);
|
|
261
260
|
* if (matches) console.log(`${matches.length} Twitter profiles found!`);
|
|
@@ -280,7 +279,7 @@ export declare const TWITTER_REGEX_GLOBAL: RegExp;
|
|
|
280
279
|
*
|
|
281
280
|
* Example usage:
|
|
282
281
|
* ```
|
|
283
|
-
* import { social } from '
|
|
282
|
+
* import { social } from 'crawlee';
|
|
284
283
|
*
|
|
285
284
|
* if (social.FACEBOOK_REGEX.test('https://www.facebook.com/apifytech')) {
|
|
286
285
|
* console.log('Match!');
|
|
@@ -309,7 +308,7 @@ export declare const FACEBOOK_REGEX: RegExp;
|
|
|
309
308
|
*
|
|
310
309
|
* Example usage:
|
|
311
310
|
* ```
|
|
312
|
-
* import { social } from '
|
|
311
|
+
* import { social } from 'crawlee';
|
|
313
312
|
*
|
|
314
313
|
* const matches = text.match(social.FACEBOOK_REGEX_GLOBAL);
|
|
315
314
|
* if (matches) console.log(`${matches.length} Facebook profiles found!`);
|
|
@@ -331,7 +330,7 @@ export declare const FACEBOOK_REGEX_GLOBAL: RegExp;
|
|
|
331
330
|
*
|
|
332
331
|
* Example usage:
|
|
333
332
|
* ```
|
|
334
|
-
* import { social } from '
|
|
333
|
+
* import { social } from 'crawlee';
|
|
335
334
|
*
|
|
336
335
|
* if (social.YOUTUBE_REGEX.test('https://www.youtube.com/watch?v=kM7YfhfkiEE')) {
|
|
337
336
|
* console.log('Match!');
|
|
@@ -354,7 +353,7 @@ export declare const YOUTUBE_REGEX: RegExp;
|
|
|
354
353
|
*
|
|
355
354
|
* Example usage:
|
|
356
355
|
* ```
|
|
357
|
-
* import { social } from '
|
|
356
|
+
* import { social } from 'crawlee';
|
|
358
357
|
*
|
|
359
358
|
* const matches = text.match(social.YOUTUBE_REGEX_GLOBAL);
|
|
360
359
|
* if (matches) console.log(`${matches.length} Youtube videos found!`);
|
|
@@ -375,7 +374,7 @@ export declare const YOUTUBE_REGEX_GLOBAL: RegExp;
|
|
|
375
374
|
*
|
|
376
375
|
* Example usage:
|
|
377
376
|
* ```
|
|
378
|
-
* import { social } from '
|
|
377
|
+
* import { social } from 'crawlee';
|
|
379
378
|
*
|
|
380
379
|
* if (social.TIKTOK_REGEX.test('https://www.tiktok.com/trending?shareId=123456789')) {
|
|
381
380
|
* console.log('Match!');
|
|
@@ -397,7 +396,7 @@ export declare const TIKTOK_REGEX: RegExp;
|
|
|
397
396
|
*
|
|
398
397
|
* Example usage:
|
|
399
398
|
* ```
|
|
400
|
-
* import { social } from '
|
|
399
|
+
* import { social } from 'crawlee';
|
|
401
400
|
*
|
|
402
401
|
* const matches = text.match(social.TIKTOK_REGEX_GLOBAL);
|
|
403
402
|
* if (matches) console.log(`${matches.length} Tiktok profiles/videos found!`);
|
|
@@ -419,7 +418,7 @@ export declare const TIKTOK_REGEX_GLOBAL: RegExp;
|
|
|
419
418
|
*
|
|
420
419
|
* Example usage:
|
|
421
420
|
* ```
|
|
422
|
-
* import { social } from '
|
|
421
|
+
* import { social } from 'crawlee';
|
|
423
422
|
*
|
|
424
423
|
* if (social.PINTEREST_REGEX.test('https://pinterest.com/pin/123456789')) {
|
|
425
424
|
* console.log('Match!');
|
|
@@ -442,7 +441,7 @@ export declare const PINTEREST_REGEX: RegExp;
|
|
|
442
441
|
*
|
|
443
442
|
* Example usage:
|
|
444
443
|
* ```
|
|
445
|
-
* import { social } from '
|
|
444
|
+
* import { social } from 'crawlee';
|
|
446
445
|
*
|
|
447
446
|
* const matches = text.match(social.PINTEREST_REGEX_GLOBAL);
|
|
448
447
|
* if (matches) console.log(`${matches.length} Pinterest pins found!`);
|
|
@@ -462,7 +461,7 @@ export declare const PINTEREST_REGEX_GLOBAL: RegExp;
|
|
|
462
461
|
*
|
|
463
462
|
* Example usage:
|
|
464
463
|
* ```
|
|
465
|
-
* import { social } from '
|
|
464
|
+
* import { social } from 'crawlee';
|
|
466
465
|
*
|
|
467
466
|
* if (social.DISCORD_REGEX.test('https://discord.gg/discord-developers')) {
|
|
468
467
|
* console.log('Match!');
|
|
@@ -483,7 +482,7 @@ export declare const DISCORD_REGEX: RegExp;
|
|
|
483
482
|
*
|
|
484
483
|
* Example usage:
|
|
485
484
|
* ```
|
|
486
|
-
* import { social } from '
|
|
485
|
+
* import { social } from 'crawlee';
|
|
487
486
|
*
|
|
488
487
|
* const matches = text.match(social.DISCORD_REGEX_GLOBAL);
|
|
489
488
|
* if (matches) console.log(`${matches.length} Discord channels found!`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../../src/internals/social.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,WAAW,QAA6C,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAuC,CAAC;AAIvE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAGrD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAavD;AA4DD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBrD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAYvD;AAkCD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAED
|
|
1
|
+
{"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../../src/internals/social.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,e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