@crawlee/jsdom 4.0.0-beta.14 → 4.0.0-beta.141
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 +14 -14
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/internals/jsdom-crawler.d.ts +140 -117
- package/internals/jsdom-crawler.js +147 -163
- package/package.json +9 -9
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/internals/jsdom-crawler.d.ts.map +0 -1
- package/internals/jsdom-crawler.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
2
|
<a href="https://crawlee.dev">
|
|
3
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"
|
|
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
6
|
</picture>
|
|
7
7
|
</a>
|
|
8
|
-
<br
|
|
8
|
+
<br />
|
|
9
9
|
<small>A web scraping and browser automation library</small>
|
|
10
10
|
</h1>
|
|
11
11
|
|
|
12
|
-
<p align=center>
|
|
13
|
-
<a href="https://trendshift.io/repositories/5179" target="_blank"><img src="https://trendshift.io/api/badge/repositories/5179" alt="apify%2Fcrawlee | Trendshift"
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://trendshift.io/repositories/5179" target="_blank"><img src="https://trendshift.io/api/badge/repositories/5179" alt="apify%2Fcrawlee | Trendshift" width="250" height="55"/></a>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
|
-
<p align=center>
|
|
17
|
-
<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"
|
|
18
|
-
<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"
|
|
19
|
-
<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"
|
|
20
|
-
<a href="https://github.com/apify/crawlee/actions/workflows/test-ci.yml"><img src="https://github.com/apify/crawlee/actions/workflows/test-ci.yml/badge.svg?branch=master" alt="Build Status"
|
|
16
|
+
<p align="center">
|
|
17
|
+
<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" /></a>
|
|
18
|
+
<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" /></a>
|
|
19
|
+
<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" /></a>
|
|
20
|
+
<a href="https://github.com/apify/crawlee/actions/workflows/test-ci.yml"><img src="https://github.com/apify/crawlee/actions/workflows/test-ci.yml/badge.svg?branch=master" alt="Build Status" /></a>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
23
|
Crawlee covers your crawling and scraping end-to-end and **helps you build reliable scrapers. Fast.**
|
|
@@ -89,7 +89,7 @@ By default, Crawlee stores data to `./storage` in the current working directory.
|
|
|
89
89
|
We provide automated beta builds for every merged code change in Crawlee. You can find them in the npm [list of releases](https://www.npmjs.com/package/crawlee?activeTab=versions). If you want to test new features or bug fixes before we release them, feel free to install a beta build like this:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
npm install crawlee@
|
|
92
|
+
npm install crawlee@next
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
If you also use the [Apify SDK](https://github.com/apify/apify-sdk-js), you need to specify dependency overrides in your `package.json` file so that you don't end up with multiple versions of Crawlee installed:
|
|
@@ -98,9 +98,9 @@ If you also use the [Apify SDK](https://github.com/apify/apify-sdk-js), you need
|
|
|
98
98
|
{
|
|
99
99
|
"overrides": {
|
|
100
100
|
"apify": {
|
|
101
|
-
"@crawlee/core": "
|
|
102
|
-
"@crawlee/types": "
|
|
103
|
-
"@crawlee/utils": "
|
|
101
|
+
"@crawlee/core": "$crawlee",
|
|
102
|
+
"@crawlee/types": "$crawlee",
|
|
103
|
+
"@crawlee/utils": "$crawlee"
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AddRequestsBatchedResult, ContextPipeline, CrawlingContext, EnqueueLinksOptions, ErrorHandler, ExtractLinksOptions, GetUserDataFromRequest, HttpCrawlerOptions, InternalHttpCrawlingContext, InternalHttpHook, RequestHandler, RouterHandler, RouterRoutes, RouteSchemas, RoutesFromSchemas } from '@crawlee/http';
|
|
2
2
|
import { HttpCrawler } from '@crawlee/http';
|
|
3
3
|
import type { Dictionary } from '@crawlee/types';
|
|
4
|
-
import
|
|
4
|
+
import type { CheerioAPI } from 'cheerio';
|
|
5
5
|
import type { DOMWindow } from 'jsdom';
|
|
6
6
|
import { VirtualConsole } from 'jsdom';
|
|
7
|
+
import { z } from 'zod';
|
|
7
8
|
export type JSDOMErrorHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
|
|
8
|
-
JSONData extends Dictionary = any
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
JSONData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
|
|
10
|
+
ContextExtension = Dictionary<never>> = ErrorHandler<CrawlingContext, JSDOMCrawlingContext<UserData, JSONData> & ContextExtension>;
|
|
11
|
+
export interface JSDOMCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends JSDOMCrawlingContext = JSDOMCrawlingContext & ContextExtension, UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
|
|
12
|
+
JSONData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
|
|
13
|
+
Routes extends Record<keyof Routes, Dictionary> = Record<string, UserData>, StatisticStateExtension extends object = {}> extends HttpCrawlerOptions<JSDOMCrawlingContext<UserData, JSONData>, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
|
|
11
14
|
/**
|
|
12
15
|
* Download and run scripts.
|
|
13
16
|
*/
|
|
@@ -50,101 +53,140 @@ JSONData extends Dictionary = any> extends InternalHttpCrawlingContext<UserData,
|
|
|
50
53
|
* });
|
|
51
54
|
* ```
|
|
52
55
|
*/
|
|
53
|
-
parseWithCheerio(selector?: string, timeoutMs?: number): Promise<
|
|
56
|
+
parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioAPI>;
|
|
57
|
+
/**
|
|
58
|
+
* Extracts URLs from the parsed DOM, without adding them to the request queue.
|
|
59
|
+
*/
|
|
60
|
+
extractLinks(options?: ExtractLinksOptions): Promise<string[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Helper function for extracting URLs from the parsed DOM and adding them to the request queue.
|
|
63
|
+
*/
|
|
64
|
+
enqueueLinks(options?: EnqueueLinksOptions): Promise<AddRequestsBatchedResult>;
|
|
54
65
|
}
|
|
55
66
|
export type JSDOMRequestHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
|
|
56
67
|
JSONData extends Dictionary = any> = RequestHandler<JSDOMCrawlingContext<UserData, JSONData>>;
|
|
57
|
-
export declare class JSDOMCrawler<ExtendedContext extends JSDOMCrawlingContext = JSDOMCrawlingContext> extends HttpCrawler<JSDOMCrawlingContext, ExtendedContext> {
|
|
68
|
+
export declare class JSDOMCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends JSDOMCrawlingContext = JSDOMCrawlingContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<JSDOMCrawlingContext['request']>>, StatisticStateExtension extends object = {}> extends HttpCrawler<JSDOMCrawlingContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
|
|
69
|
+
#private;
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
58
73
|
protected static optionsShape: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
useSessionPool: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
|
|
115
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
116
|
-
proxyConfiguration: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
117
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
118
|
-
statusMessageLoggingInterval: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
119
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
120
|
-
statusMessageCallback: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
121
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
122
|
-
retryOnBlocked: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
|
|
123
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
124
|
-
respectRobotsTxtFile: import("ow").AnyPredicate<boolean | object>;
|
|
125
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
126
|
-
onSkippedRequest: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
127
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
128
|
-
httpClient: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
129
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
130
|
-
minConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
131
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
132
|
-
maxConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
133
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
134
|
-
maxRequestsPerMinute: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
135
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
136
|
-
keepAlive: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
|
|
137
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
138
|
-
log: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
139
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
140
|
-
experiments: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
141
|
-
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
142
|
-
statisticsOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
74
|
+
runScripts: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
hideInternalConsole: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
77
|
+
ignoreTlsErrors: z.ZodDefault<z.ZodBoolean>;
|
|
78
|
+
additionalMimeTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
79
|
+
suggestResponseEncoding: z.ZodOptional<z.ZodString>;
|
|
80
|
+
forceResponseEncoding: z.ZodOptional<z.ZodString>;
|
|
81
|
+
saveResponseCookies: z.ZodDefault<z.ZodBoolean>;
|
|
82
|
+
preNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
|
|
83
|
+
postNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
|
|
84
|
+
contextPipelineBuilder: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
85
|
+
extendContext: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
86
|
+
requestList: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
87
|
+
requestQueue: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
88
|
+
requestManager: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
89
|
+
requestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
90
|
+
requestHandlerTimeoutSecs: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
91
|
+
errorHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
92
|
+
failedRequestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
93
|
+
maxRequestRetries: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
94
|
+
sameDomainDelaySecs: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
95
|
+
maxRequestsPerCrawl: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
96
|
+
maxCrawlDepth: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
97
|
+
taskLoopOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
98
|
+
concurrencySystem: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
99
|
+
sessionPool: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
100
|
+
proxyConfiguration: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
101
|
+
statusMessageLoggingInterval: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
102
|
+
statusMessageCallback: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
103
|
+
additionalHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
|
|
104
|
+
ignoreHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
|
|
105
|
+
blockedStatusCodes: z.ZodOptional<z.ZodArray<z.ZodCustom<number, number>>>;
|
|
106
|
+
retryOnBlocked: z.ZodDefault<z.ZodBoolean>;
|
|
107
|
+
respectRobotsTxtFile: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<Dictionary, Dictionary>]>>;
|
|
108
|
+
transactionalStorage: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
109
|
+
requestQueue: z.ZodOptional<z.ZodEnum<{
|
|
110
|
+
deferred: "deferred";
|
|
111
|
+
writeThrough: "writeThrough";
|
|
112
|
+
}>>;
|
|
113
|
+
}, z.core.$strict>]>>;
|
|
114
|
+
onSkippedRequest: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
115
|
+
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
116
|
+
httpClient: z.ZodOptional<z.ZodCustom<import("@crawlee/http-client").BaseHttpClient, import("@crawlee/http-client").BaseHttpClient>>;
|
|
117
|
+
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
118
|
+
configuration: z.ZodOptional<z.ZodCustom<import("@crawlee/http").Configuration, import("@crawlee/http").Configuration>>;
|
|
119
|
+
storageBackend: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
120
|
+
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
121
|
+
eventManager: z.ZodOptional<z.ZodCustom<import("@crawlee/http").EventManager, import("@crawlee/http").EventManager>>;
|
|
122
|
+
logger: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
123
|
+
minConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
124
|
+
maxConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
125
|
+
maxRequestsPerMinute: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
126
|
+
keepAlive: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
statistics: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
128
|
+
id: z.ZodOptional<z.ZodString>;
|
|
143
129
|
};
|
|
144
|
-
|
|
145
|
-
protected
|
|
146
|
-
|
|
147
|
-
|
|
130
|
+
/** @internal */
|
|
131
|
+
protected static optionsSchema: z.ZodObject<{
|
|
132
|
+
runScripts: z.ZodOptional<z.ZodBoolean>;
|
|
133
|
+
hideInternalConsole: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
135
|
+
ignoreTlsErrors: z.ZodDefault<z.ZodBoolean>;
|
|
136
|
+
additionalMimeTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
137
|
+
suggestResponseEncoding: z.ZodOptional<z.ZodString>;
|
|
138
|
+
forceResponseEncoding: z.ZodOptional<z.ZodString>;
|
|
139
|
+
saveResponseCookies: z.ZodDefault<z.ZodBoolean>;
|
|
140
|
+
preNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
|
|
141
|
+
postNavigationHooks: z.ZodDefault<z.ZodCustom<unknown[], unknown[]>>;
|
|
142
|
+
contextPipelineBuilder: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
143
|
+
extendContext: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
144
|
+
requestList: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
145
|
+
requestQueue: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
146
|
+
requestManager: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
147
|
+
requestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
148
|
+
requestHandlerTimeoutSecs: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
149
|
+
errorHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
150
|
+
failedRequestHandler: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
151
|
+
maxRequestRetries: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
152
|
+
sameDomainDelaySecs: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
153
|
+
maxRequestsPerCrawl: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
154
|
+
maxCrawlDepth: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
155
|
+
taskLoopOptions: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
156
|
+
concurrencySystem: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
157
|
+
sessionPool: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
158
|
+
proxyConfiguration: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
159
|
+
statusMessageLoggingInterval: z.ZodDefault<z.ZodCustom<number, number>>;
|
|
160
|
+
statusMessageCallback: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
161
|
+
additionalHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
|
|
162
|
+
ignoreHttpErrorStatusCodes: z.ZodDefault<z.ZodArray<z.ZodCustom<number, number>>>;
|
|
163
|
+
blockedStatusCodes: z.ZodOptional<z.ZodArray<z.ZodCustom<number, number>>>;
|
|
164
|
+
retryOnBlocked: z.ZodDefault<z.ZodBoolean>;
|
|
165
|
+
respectRobotsTxtFile: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<Dictionary, Dictionary>]>>;
|
|
166
|
+
transactionalStorage: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
167
|
+
requestQueue: z.ZodOptional<z.ZodEnum<{
|
|
168
|
+
deferred: "deferred";
|
|
169
|
+
writeThrough: "writeThrough";
|
|
170
|
+
}>>;
|
|
171
|
+
}, z.core.$strict>]>>;
|
|
172
|
+
onSkippedRequest: z.ZodOptional<z.ZodCustom<(...args: any[]) => unknown, (...args: any[]) => unknown>>;
|
|
173
|
+
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
174
|
+
httpClient: z.ZodOptional<z.ZodCustom<import("@crawlee/http-client").BaseHttpClient, import("@crawlee/http-client").BaseHttpClient>>;
|
|
175
|
+
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
176
|
+
configuration: z.ZodOptional<z.ZodCustom<import("@crawlee/http").Configuration, import("@crawlee/http").Configuration>>;
|
|
177
|
+
storageBackend: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
178
|
+
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
179
|
+
eventManager: z.ZodOptional<z.ZodCustom<import("@crawlee/http").EventManager, import("@crawlee/http").EventManager>>;
|
|
180
|
+
logger: z.ZodOptional<z.ZodType<Dictionary<any>, unknown, z.core.$ZodTypeInternals<Dictionary<any>, unknown>>>;
|
|
181
|
+
minConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
182
|
+
maxConcurrency: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
183
|
+
maxRequestsPerMinute: z.ZodOptional<z.ZodCustom<number, number>>;
|
|
184
|
+
keepAlive: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
statistics: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
|
|
186
|
+
id: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}, z.core.$strict>;
|
|
188
|
+
constructor(options?: JSDOMCrawlerOptions<ContextExtension, ExtendedContext, any, any, Routes, StatisticStateExtension>);
|
|
189
|
+
protected buildContextPipeline(): ContextPipeline<CrawlingContext, JSDOMCrawlingContext>;
|
|
148
190
|
/**
|
|
149
191
|
* Returns the currently used `VirtualConsole` instance. Can be used to listen for the JSDOM's internal console messages.
|
|
150
192
|
*
|
|
@@ -164,24 +206,6 @@ export declare class JSDOMCrawler<ExtendedContext extends JSDOMCrawlingContext =
|
|
|
164
206
|
private parseContent;
|
|
165
207
|
private addHelpers;
|
|
166
208
|
}
|
|
167
|
-
interface EnqueueLinksInternalOptions {
|
|
168
|
-
options?: EnqueueLinksOptions;
|
|
169
|
-
window: DOMWindow | null;
|
|
170
|
-
requestQueue: RequestProvider;
|
|
171
|
-
robotsTxtFile?: RobotsTxtFile;
|
|
172
|
-
onSkippedRequest?: SkippedRequestCallback;
|
|
173
|
-
originalRequestUrl: string;
|
|
174
|
-
finalRequestUrl?: string;
|
|
175
|
-
}
|
|
176
|
-
interface BoundEnqueueLinksInternalOptions {
|
|
177
|
-
enqueueLinks: BasicCrawlingContext['enqueueLinks'];
|
|
178
|
-
options?: EnqueueLinksOptions;
|
|
179
|
-
window: DOMWindow | null;
|
|
180
|
-
originalRequestUrl: string;
|
|
181
|
-
finalRequestUrl?: string;
|
|
182
|
-
}
|
|
183
|
-
/** @internal */
|
|
184
|
-
export declare function domCrawlerEnqueueLinks(options: EnqueueLinksInternalOptions | BoundEnqueueLinksInternalOptions): Promise<unknown>;
|
|
185
209
|
/**
|
|
186
210
|
* Creates new {@link Router} instance that works based on request labels.
|
|
187
211
|
* This instance can then serve as a `requestHandler` of your {@link JSDOMCrawler}.
|
|
@@ -206,7 +230,6 @@ export declare function domCrawlerEnqueueLinks(options: EnqueueLinksInternalOpti
|
|
|
206
230
|
* await crawler.run();
|
|
207
231
|
* ```
|
|
208
232
|
*/
|
|
209
|
-
|
|
210
|
-
export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, UserData
|
|
211
|
-
export
|
|
212
|
-
//# sourceMappingURL=jsdom-crawler.d.ts.map
|
|
233
|
+
export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<Context['request']>>>(routes?: RouterRoutes<Context, Routes>): RouterHandler<Context, Routes>;
|
|
234
|
+
export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, Record<string, UserData>>): RouterHandler<Context, Record<string, UserData>>;
|
|
235
|
+
export declare function createJSDOMRouter<Context extends JSDOMCrawlingContext = JSDOMCrawlingContext, const Schemas extends RouteSchemas = RouteSchemas>(schemas: Schemas): RouterHandler<Context, RoutesFromSchemas<Schemas>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnqueueStrategy, HttpCrawler, NavigationSkippedError, resolveBaseUrlForEnqueueLinksFiltering, Router, } from '@crawlee/http';
|
|
2
2
|
import { sleep } from '@crawlee/utils';
|
|
3
|
-
import
|
|
3
|
+
import { parseArgument, tryAbsoluteURL } from '@crawlee/utils/internal';
|
|
4
4
|
import { JSDOM, ResourceLoader, VirtualConsole } from 'jsdom';
|
|
5
|
-
import
|
|
5
|
+
import { z } from 'zod';
|
|
6
6
|
import { addTimeoutToPromise } from '@apify/timeout';
|
|
7
7
|
/**
|
|
8
8
|
* Provides a framework for the parallel crawling of web pages using plain HTTP requests and
|
|
@@ -26,38 +26,40 @@ import { addTimeoutToPromise } from '@apify/timeout';
|
|
|
26
26
|
* and then invokes the user-provided {@link JSDOMCrawlerOptions.requestHandler} to extract page data
|
|
27
27
|
* using the `window` object.
|
|
28
28
|
*
|
|
29
|
-
* The source URLs are represented using {@link Request} objects that are fed from
|
|
30
|
-
* {@link
|
|
31
|
-
*
|
|
29
|
+
* The source URLs are represented using {@link Request} objects that are fed from the
|
|
30
|
+
* {@link IRequestManager|request manager} provided via the {@link JSDOMCrawlerOptions.requestManager|`requestManager`}
|
|
31
|
+
* constructor option (a {@link RequestQueue} is itself a request manager). To read from a read-only source such
|
|
32
|
+
* as a {@link RequestList} while still being able to enqueue new requests, combine it with a queue into a
|
|
33
|
+
* {@link RequestManagerTandem} via {@link IRequestLoader.toTandem|`requestLoader.toTandem()`} and pass the
|
|
34
|
+
* result as `requestManager`.
|
|
32
35
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
|
|
36
|
+
* > The {@link JSDOMCrawlerOptions.requestList|`requestList`} and {@link JSDOMCrawlerOptions.requestQueue|`requestQueue`}
|
|
37
|
+
* > options are deprecated; they are still accepted and folded into a single `requestManager` for back-compat.
|
|
36
38
|
*
|
|
37
39
|
* The crawler finishes when there are no more {@link Request} objects to crawl.
|
|
38
40
|
*
|
|
39
|
-
* We can use the `preNavigationHooks` to adjust
|
|
41
|
+
* We can use the `preNavigationHooks` to adjust the crawling context before the request is made:
|
|
40
42
|
*
|
|
41
43
|
* ```
|
|
42
44
|
* preNavigationHooks: [
|
|
43
|
-
* (crawlingContext
|
|
45
|
+
* (crawlingContext) => {
|
|
44
46
|
* // ...
|
|
45
47
|
* },
|
|
46
48
|
* ]
|
|
47
49
|
* ```
|
|
48
50
|
*
|
|
49
|
-
* By default, `JSDOMCrawler` only processes web pages with the `text/html`
|
|
50
|
-
* and `application/
|
|
51
|
+
* By default, `JSDOMCrawler` only processes web pages with the `text/html`, `application/xhtml+xml`, `text/xml`, `application/xml`,
|
|
52
|
+
* and `application/json` MIME content types (as reported by the `Content-Type` HTTP header),
|
|
51
53
|
* and skips pages with other content types. If you want the crawler to process other content types,
|
|
52
54
|
* use the {@link JSDOMCrawlerOptions.additionalMimeTypes} constructor option.
|
|
53
55
|
* Beware that the parsing behavior differs for HTML, XML, JSON and other types of content.
|
|
54
56
|
* For more details, see {@link JSDOMCrawlerOptions.requestHandler}.
|
|
55
57
|
*
|
|
56
|
-
* New requests are only dispatched when there is enough free CPU and memory available,
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* {@link
|
|
58
|
+
* New requests are only dispatched when there is enough free CPU and memory available, as judged by the crawler's
|
|
59
|
+
* {@link ConcurrencySystem}.
|
|
60
|
+
* Concurrency is tuned via the `minConcurrency`, `maxConcurrency` and `maxRequestsPerMinute` options of the
|
|
61
|
+
* `JSDOMCrawler` constructor, or, for finer control, by injecting a pre-configured
|
|
62
|
+
* {@link ConcurrencySystem|`concurrencySystem`}.
|
|
61
63
|
*
|
|
62
64
|
* **Example usage:**
|
|
63
65
|
*
|
|
@@ -83,30 +85,39 @@ const resources = new ResourceLoader({
|
|
|
83
85
|
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
|
|
84
86
|
});
|
|
85
87
|
export class JSDOMCrawler extends HttpCrawler {
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
86
91
|
static optionsShape = {
|
|
87
92
|
...HttpCrawler.optionsShape,
|
|
88
|
-
runScripts:
|
|
89
|
-
hideInternalConsole:
|
|
93
|
+
runScripts: z.boolean().optional(),
|
|
94
|
+
hideInternalConsole: z.boolean().optional(),
|
|
90
95
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
/** @internal */
|
|
97
|
+
static optionsSchema = z.strictObject(JSDOMCrawler.optionsShape);
|
|
98
|
+
#runScripts;
|
|
99
|
+
#hideInternalConsole;
|
|
100
|
+
#virtualConsole = null;
|
|
101
|
+
constructor(options = {}) {
|
|
102
|
+
const { runScripts = false, hideInternalConsole = false, contextPipelineBuilder, ...httpOptions } = parseArgument(options, JSDOMCrawler.optionsSchema, 'JSDOMCrawlerOptions');
|
|
96
103
|
super({
|
|
97
104
|
...httpOptions,
|
|
98
|
-
contextPipelineBuilder: () => this.buildContextPipeline()
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
contextPipelineBuilder: contextPipelineBuilder ?? (() => this.buildContextPipeline()),
|
|
106
|
+
});
|
|
107
|
+
this.#runScripts = runScripts;
|
|
108
|
+
this.#hideInternalConsole = hideInternalConsole;
|
|
109
|
+
}
|
|
110
|
+
buildContextPipeline() {
|
|
111
|
+
return super
|
|
112
|
+
.buildContextPipeline()
|
|
113
|
+
.compose({
|
|
114
|
+
action: async (context) => await this.parseContent(context),
|
|
115
|
+
cleanup: async (context) => {
|
|
116
|
+
this.getVirtualConsole().off('jsdomError', this.jsdomErrorHandler);
|
|
117
|
+
context.window?.close();
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
.compose({ action: async (context) => await this.addHelpers(context) });
|
|
110
121
|
}
|
|
111
122
|
/**
|
|
112
123
|
* Returns the currently used `VirtualConsole` instance. Can be used to listen for the JSDOM's internal console messages.
|
|
@@ -123,86 +134,116 @@ export class JSDOMCrawler extends HttpCrawler {
|
|
|
123
134
|
* ```
|
|
124
135
|
*/
|
|
125
136
|
getVirtualConsole() {
|
|
126
|
-
if (this
|
|
127
|
-
return this
|
|
137
|
+
if (this.#virtualConsole) {
|
|
138
|
+
return this.#virtualConsole;
|
|
128
139
|
}
|
|
129
|
-
this
|
|
130
|
-
if (!this
|
|
131
|
-
this
|
|
140
|
+
this.#virtualConsole = new VirtualConsole();
|
|
141
|
+
if (!this.#hideInternalConsole) {
|
|
142
|
+
this.#virtualConsole.sendTo(console, { omitJSDOMErrors: true });
|
|
132
143
|
}
|
|
133
|
-
this
|
|
134
|
-
return this
|
|
144
|
+
this.#virtualConsole.on('jsdomError', this.jsdomErrorHandler);
|
|
145
|
+
return this.#virtualConsole;
|
|
135
146
|
}
|
|
136
|
-
jsdomErrorHandler = (error) => this.log.debug('JSDOM error from console', error);
|
|
147
|
+
jsdomErrorHandler = (error) => this.log.debug('JSDOM error from console', { error });
|
|
137
148
|
async parseContent(crawlingContext) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
149
|
+
try {
|
|
150
|
+
const isXml = crawlingContext.contentType.type.includes('xml');
|
|
151
|
+
// TODO handle non-string
|
|
152
|
+
const { window } = new JSDOM(crawlingContext.body.toString(), {
|
|
153
|
+
url: crawlingContext.response.url,
|
|
154
|
+
contentType: isXml ? 'text/xml' : 'text/html',
|
|
155
|
+
runScripts: this.#runScripts ? 'dangerously' : undefined,
|
|
156
|
+
resources,
|
|
157
|
+
virtualConsole: this.getVirtualConsole(),
|
|
158
|
+
pretendToBeVisual: true,
|
|
159
|
+
});
|
|
160
|
+
// add some stubs in place of missing API so processing won't fail
|
|
161
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
162
|
+
writable: true,
|
|
163
|
+
value: (query) => ({
|
|
164
|
+
matches: false,
|
|
165
|
+
media: query,
|
|
166
|
+
onchange: null,
|
|
167
|
+
addListener: () => { },
|
|
168
|
+
removeListener: () => { },
|
|
169
|
+
addEventListener: () => { },
|
|
170
|
+
removeEventListener: () => { },
|
|
171
|
+
dispatchEvent: () => { },
|
|
172
|
+
}),
|
|
173
|
+
});
|
|
174
|
+
window.document.createRange = () => {
|
|
175
|
+
const range = new window.Range();
|
|
176
|
+
range.getBoundingClientRect = () => ({});
|
|
177
|
+
range.getClientRects = () => ({ item: () => null, length: 0 });
|
|
178
|
+
return range;
|
|
179
|
+
};
|
|
180
|
+
if (this.#runScripts) {
|
|
181
|
+
try {
|
|
182
|
+
await addTimeoutToPromise(async () => {
|
|
183
|
+
return new Promise((resolve) => {
|
|
184
|
+
window.addEventListener('load', () => {
|
|
185
|
+
resolve();
|
|
186
|
+
}, false);
|
|
187
|
+
}).catch();
|
|
188
|
+
}, 10_000, 'Window.load event not fired after 10 seconds.').catch();
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
this.log.debug(e.message);
|
|
192
|
+
}
|
|
177
193
|
}
|
|
178
|
-
|
|
179
|
-
|
|
194
|
+
return {
|
|
195
|
+
window,
|
|
196
|
+
get body() {
|
|
197
|
+
return window.document.documentElement.outerHTML;
|
|
198
|
+
},
|
|
199
|
+
get document() {
|
|
200
|
+
return window.document;
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
if (err instanceof NavigationSkippedError) {
|
|
206
|
+
return {
|
|
207
|
+
get window() {
|
|
208
|
+
throw new NavigationSkippedError('The `window` property is not available - `skipNavigation` was used', { cause: err });
|
|
209
|
+
},
|
|
210
|
+
get body() {
|
|
211
|
+
throw new NavigationSkippedError('The `body` property is not available - `skipNavigation` was used', { cause: err });
|
|
212
|
+
},
|
|
213
|
+
get document() {
|
|
214
|
+
throw new NavigationSkippedError('The `document` property is not available - `skipNavigation` was used', { cause: err });
|
|
215
|
+
},
|
|
216
|
+
};
|
|
180
217
|
}
|
|
218
|
+
throw err;
|
|
181
219
|
}
|
|
182
|
-
return {
|
|
183
|
-
window,
|
|
184
|
-
get body() {
|
|
185
|
-
return window.document.documentElement.outerHTML;
|
|
186
|
-
},
|
|
187
|
-
get document() {
|
|
188
|
-
return window.document;
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
220
|
}
|
|
192
221
|
async addHelpers(crawlingContext) {
|
|
222
|
+
const addRequests = crawlingContext.addRequests;
|
|
223
|
+
const extractLinks = async (options) => {
|
|
224
|
+
if (!crawlingContext.window) {
|
|
225
|
+
throw new Error('Cannot extract links because the JSDOM is not available.');
|
|
226
|
+
}
|
|
227
|
+
return extractUrlsFromWindow(crawlingContext.window, options?.selector ?? 'a', options?.baseUrl ?? crawlingContext.request.loadedUrl ?? crawlingContext.request.url);
|
|
228
|
+
};
|
|
193
229
|
return {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
requestQueue: await this.getRequestQueue(),
|
|
199
|
-
robotsTxtFile: await this.getRobotsTxtFileForUrl(crawlingContext.request.url),
|
|
200
|
-
onSkippedRequest: this.handleSkippedRequest,
|
|
201
|
-
originalRequestUrl: crawlingContext.request.url,
|
|
230
|
+
extractLinks,
|
|
231
|
+
enqueueLinks: async (options = {}) => {
|
|
232
|
+
const baseUrl = resolveBaseUrlForEnqueueLinksFiltering({
|
|
233
|
+
enqueueStrategy: options.strategy,
|
|
202
234
|
finalRequestUrl: crawlingContext.request.loadedUrl,
|
|
235
|
+
originalRequestUrl: crawlingContext.request.url,
|
|
236
|
+
userProvidedBaseUrl: options.baseUrl,
|
|
237
|
+
});
|
|
238
|
+
const urls = await extractLinks(options);
|
|
239
|
+
return addRequests(urls, {
|
|
240
|
+
...options,
|
|
241
|
+
baseUrl,
|
|
242
|
+
strategy: options.strategy ?? EnqueueStrategy.SameHostname,
|
|
203
243
|
});
|
|
204
244
|
},
|
|
205
245
|
async waitForSelector(selector, timeoutMs = 5_000) {
|
|
246
|
+
const cheerio = await import('cheerio');
|
|
206
247
|
const $ = cheerio.load(crawlingContext.body);
|
|
207
248
|
if ($(selector).get().length === 0) {
|
|
208
249
|
if (timeoutMs) {
|
|
@@ -214,6 +255,7 @@ export class JSDOMCrawler extends HttpCrawler {
|
|
|
214
255
|
}
|
|
215
256
|
},
|
|
216
257
|
async parseWithCheerio(selector, _timeoutMs = 5_000) {
|
|
258
|
+
const cheerio = await import('cheerio');
|
|
217
259
|
const $ = cheerio.load(crawlingContext.body);
|
|
218
260
|
if (selector && $(selector).get().length === 0) {
|
|
219
261
|
throw new Error(`Selector '${selector}' not found.`);
|
|
@@ -223,39 +265,6 @@ export class JSDOMCrawler extends HttpCrawler {
|
|
|
223
265
|
};
|
|
224
266
|
}
|
|
225
267
|
}
|
|
226
|
-
/** @internal */
|
|
227
|
-
function containsEnqueueLinks(options) {
|
|
228
|
-
return !!options.enqueueLinks;
|
|
229
|
-
}
|
|
230
|
-
/** @internal */
|
|
231
|
-
export async function domCrawlerEnqueueLinks(options) {
|
|
232
|
-
const { options: enqueueLinksOptions, window, originalRequestUrl, finalRequestUrl } = options;
|
|
233
|
-
if (!window) {
|
|
234
|
-
throw new Error('Cannot enqueue links because the JSDOM is not available.');
|
|
235
|
-
}
|
|
236
|
-
const baseUrl = resolveBaseUrlForEnqueueLinksFiltering({
|
|
237
|
-
enqueueStrategy: enqueueLinksOptions?.strategy,
|
|
238
|
-
finalRequestUrl,
|
|
239
|
-
originalRequestUrl,
|
|
240
|
-
userProvidedBaseUrl: enqueueLinksOptions?.baseUrl,
|
|
241
|
-
});
|
|
242
|
-
const urls = extractUrlsFromWindow(window, enqueueLinksOptions?.selector ?? 'a', enqueueLinksOptions?.baseUrl ?? finalRequestUrl ?? originalRequestUrl);
|
|
243
|
-
if (containsEnqueueLinks(options)) {
|
|
244
|
-
return options.enqueueLinks({
|
|
245
|
-
urls,
|
|
246
|
-
baseUrl,
|
|
247
|
-
...enqueueLinksOptions,
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
return enqueueLinks({
|
|
251
|
-
requestQueue: options.requestQueue,
|
|
252
|
-
robotsTxtFile: options.robotsTxtFile,
|
|
253
|
-
onSkippedRequest: options.onSkippedRequest,
|
|
254
|
-
urls,
|
|
255
|
-
baseUrl,
|
|
256
|
-
...enqueueLinksOptions,
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
268
|
/**
|
|
260
269
|
* Extracts URLs from a given Window object.
|
|
261
270
|
* @ignore
|
|
@@ -272,31 +281,6 @@ function extractUrlsFromWindow(window, selector, baseUrl) {
|
|
|
272
281
|
})
|
|
273
282
|
.filter((href) => href !== undefined && href !== '');
|
|
274
283
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
* This instance can then serve as a `requestHandler` of your {@link JSDOMCrawler}.
|
|
278
|
-
* Defaults to the {@link JSDOMCrawlingContext}.
|
|
279
|
-
*
|
|
280
|
-
* > Serves as a shortcut for using `Router.create<JSDOMCrawlingContext>()`.
|
|
281
|
-
*
|
|
282
|
-
* ```ts
|
|
283
|
-
* import { JSDOMCrawler, createJSDOMRouter } from 'crawlee';
|
|
284
|
-
*
|
|
285
|
-
* const router = createJSDOMRouter();
|
|
286
|
-
* router.addHandler('label-a', async (ctx) => {
|
|
287
|
-
* ctx.log.info('...');
|
|
288
|
-
* });
|
|
289
|
-
* router.addDefaultHandler(async (ctx) => {
|
|
290
|
-
* ctx.log.info('...');
|
|
291
|
-
* });
|
|
292
|
-
*
|
|
293
|
-
* const crawler = new JSDOMCrawler({
|
|
294
|
-
* requestHandler: router,
|
|
295
|
-
* });
|
|
296
|
-
* await crawler.run();
|
|
297
|
-
* ```
|
|
298
|
-
*/
|
|
299
|
-
export function createJSDOMRouter(routes) {
|
|
300
|
-
return Router.create(routes);
|
|
284
|
+
export function createJSDOMRouter(routesOrSchemas) {
|
|
285
|
+
return Router.create(routesOrSchemas);
|
|
301
286
|
}
|
|
302
|
-
//# sourceMappingURL=jsdom-crawler.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/jsdom",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.141",
|
|
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": ">=22.0.0"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://crawlee.dev",
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "
|
|
41
|
+
"build": "pnpm clean && pnpm compile && pnpm copy",
|
|
42
42
|
"clean": "rimraf ./dist",
|
|
43
43
|
"compile": "tsc -p tsconfig.build.json",
|
|
44
44
|
"copy": "tsx ../../scripts/copy.ts"
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@apify/timeout": "^0.
|
|
50
|
+
"@apify/timeout": "^0.4.4",
|
|
51
51
|
"@apify/utilities": "^2.7.10",
|
|
52
|
-
"@crawlee/http": "4.0.0-beta.
|
|
53
|
-
"@crawlee/types": "4.0.0-beta.
|
|
54
|
-
"@crawlee/utils": "4.0.0-beta.
|
|
52
|
+
"@crawlee/http": "4.0.0-beta.141",
|
|
53
|
+
"@crawlee/types": "4.0.0-beta.141",
|
|
54
|
+
"@crawlee/utils": "4.0.0-beta.141",
|
|
55
55
|
"@types/jsdom": "^21.1.7",
|
|
56
56
|
"cheerio": "^1.0.0",
|
|
57
57
|
"jsdom": "^26.1.0",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
58
|
+
"tslib": "^2.8.1",
|
|
59
|
+
"zod": "^4.4.3"
|
|
60
60
|
},
|
|
61
61
|
"lerna": {
|
|
62
62
|
"command": {
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "6f97ccc5beda6b4ec0455b26323dba311a5799e4"
|
|
69
69
|
}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC"}
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsdom-crawler.d.ts","sourceRoot":"","sources":["../../src/internals/jsdom-crawler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,sBAAsB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEH,WAAW,EAId,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAS,MAAM,gBAAgB,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAyB,cAAc,EAAE,MAAM,OAAO,CAAC;AAK9D,MAAM,MAAM,iBAAiB,CACzB,QAAQ,SAAS,UAAU,GAAG,GAAG,EAAE,2EAA2E;AAC9G,QAAQ,SAAS,UAAU,GAAG,GAAG,IACjC,YAAY,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3D,MAAM,WAAW,mBAAmB,CAChC,eAAe,SAAS,oBAAoB,GAAG,oBAAoB,EACnE,QAAQ,SAAS,UAAU,GAAG,GAAG,EAAE,2EAA2E;AAC9G,QAAQ,SAAS,UAAU,GAAG,GAAG,CACnC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