@crawlee/playwright 3.13.3-beta.8 → 3.13.3
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/internals/adaptive-playwright-crawler.d.ts +9 -6
- package/internals/adaptive-playwright-crawler.d.ts.map +1 -1
- package/internals/adaptive-playwright-crawler.js +19 -14
- package/internals/adaptive-playwright-crawler.js.map +1 -1
- package/internals/enqueue-links/click-elements.d.ts +15 -15
- package/internals/enqueue-links/click-elements.js +5 -5
- package/internals/playwright-crawler.d.ts +24 -24
- package/internals/playwright-crawler.js +16 -16
- package/internals/playwright-launcher.d.ts +1 -1
- package/internals/playwright-launcher.js +1 -1
- package/internals/utils/playwright-utils.d.ts +9 -9
- package/internals/utils/playwright-utils.js +2 -2
- package/package.json +7 -7
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -62,7 +62,7 @@ export interface AdaptivePlaywrightCrawlerContext<UserData extends Dictionary =
|
|
|
62
62
|
*/
|
|
63
63
|
waitForSelector(selector: string, timeoutMs?: number): Promise<void>;
|
|
64
64
|
/**
|
|
65
|
-
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@
|
|
65
|
+
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@link CheerioCrawler}.
|
|
66
66
|
* When provided with the `selector` argument, it will first look for the selector with a 5s timeout.
|
|
67
67
|
*
|
|
68
68
|
* **Example usage:**
|
|
@@ -83,7 +83,7 @@ export interface AdaptivePlaywrightCrawlerOptions extends Omit<PlaywrightCrawler
|
|
|
83
83
|
/**
|
|
84
84
|
* Function that is called to process each request.
|
|
85
85
|
*
|
|
86
|
-
* The function receives the {@
|
|
86
|
+
* The function receives the {@link AdaptivePlaywrightCrawlingContext} as an argument, and it must refrain from calling code with side effects,
|
|
87
87
|
* other than the methods of the crawling context. Any other side effects may be invoked repeatedly by the crawler, which can lead to inconsistent results.
|
|
88
88
|
*
|
|
89
89
|
* The function must return a promise, which is then awaited by the crawler.
|
|
@@ -135,7 +135,7 @@ export interface AdaptivePlaywrightCrawlerOptions extends Omit<PlaywrightCrawler
|
|
|
135
135
|
declare const proxyLogMethods: readonly ["error", "exception", "softFail", "info", "debug", "perf", "warningOnce", "deprecated"];
|
|
136
136
|
type LogProxyCall = [log: Log, method: (typeof proxyLogMethods)[number], ...args: unknown[]];
|
|
137
137
|
/**
|
|
138
|
-
* An extension of {@
|
|
138
|
+
* An extension of {@link PlaywrightCrawler} that uses a more limited request handler interface so that it is able to switch to HTTP-only crawling when it detects it may be possible.
|
|
139
139
|
*
|
|
140
140
|
* **Example usage:**
|
|
141
141
|
*
|
|
@@ -172,8 +172,8 @@ export declare class AdaptivePlaywrightCrawler extends PlaywrightCrawler {
|
|
|
172
172
|
private preventDirectStorageAccess;
|
|
173
173
|
readonly stats: AdaptivePlaywrightCrawlerStatistics;
|
|
174
174
|
/**
|
|
175
|
-
* Default {@
|
|
176
|
-
* See {@
|
|
175
|
+
* Default {@link Router} instance that will be used if we don't specify any {@link AdaptivePlaywrightCrawlerOptions.requestHandler|`requestHandler`}.
|
|
176
|
+
* See {@link Router.addHandler|`router.addHandler()`} and {@link Router.addDefaultHandler|`router.addDefaultHandler()`}.
|
|
177
177
|
*/
|
|
178
178
|
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
179
179
|
readonly router: RouterHandler<AdaptivePlaywrightCrawlerContext>;
|
|
@@ -181,7 +181,10 @@ export declare class AdaptivePlaywrightCrawler extends PlaywrightCrawler {
|
|
|
181
181
|
protected _runRequestHandler(crawlingContext: PlaywrightCrawlingContext): Promise<void>;
|
|
182
182
|
protected commitResult(crawlingContext: PlaywrightCrawlingContext, { calls, keyValueStoreChanges }: RequestHandlerResult): Promise<void>;
|
|
183
183
|
protected allowStorageAccess<R, TArgs extends any[]>(func: (...args: TArgs) => Promise<R>): (...args: TArgs) => Promise<R>;
|
|
184
|
-
protected runRequestHandlerInBrowser(crawlingContext: PlaywrightCrawlingContext): Promise<
|
|
184
|
+
protected runRequestHandlerInBrowser(crawlingContext: PlaywrightCrawlingContext): Promise<{
|
|
185
|
+
result: Result<RequestHandlerResult>;
|
|
186
|
+
initialStateCopy?: Record<string, unknown>;
|
|
187
|
+
}>;
|
|
185
188
|
protected runRequestHandlerWithPlainHTTP(crawlingContext: PlaywrightCrawlingContext, oldStateCopy?: Dictionary): Promise<Result<RequestHandlerResult>>;
|
|
186
189
|
private createLogProxy;
|
|
187
190
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive-playwright-crawler.d.ts","sourceRoot":"","sources":["../../src/internals/adaptive-playwright-crawler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAA0B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE1G,OAAO,KAAK,EACR,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,YAAY,EAEZ,iBAAiB,EACjB,cAAc,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAU,UAAU,EAA4B,MAAM,eAAe,CAAC;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACvH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAsB,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE/F,KAAK,MAAM,CAAC,OAAO,IACb;IAAE,MAA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cAAc;CAYzB;AAED,wBAAgB,8BAA8B,CAC1C,OAAO,SAAS,gCAAgC,GAAG,gCAAgC,EACnF,QAAQ,SAAS,UAAU,GAAG,sBAAsB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAC1E,MAAM,CAAC,EAAE,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,0BAEzC"}
|
|
@@ -65,7 +65,7 @@ const proxyLogMethods = [
|
|
|
65
65
|
'deprecated',
|
|
66
66
|
];
|
|
67
67
|
/**
|
|
68
|
-
* An extension of {@
|
|
68
|
+
* An extension of {@link PlaywrightCrawler} that uses a more limited request handler interface so that it is able to switch to HTTP-only crawling when it detects it may be possible.
|
|
69
69
|
*
|
|
70
70
|
* **Example usage:**
|
|
71
71
|
*
|
|
@@ -134,8 +134,8 @@ class AdaptivePlaywrightCrawler extends playwright_crawler_1.PlaywrightCrawler {
|
|
|
134
134
|
value: void 0
|
|
135
135
|
});
|
|
136
136
|
/**
|
|
137
|
-
* Default {@
|
|
138
|
-
* See {@
|
|
137
|
+
* Default {@link Router} instance that will be used if we don't specify any {@link AdaptivePlaywrightCrawlerOptions.requestHandler|`requestHandler`}.
|
|
138
|
+
* See {@link Router.addHandler|`router.addHandler()`} and {@link Router.addDefaultHandler|`router.addDefaultHandler()`}.
|
|
139
139
|
*/
|
|
140
140
|
// @ts-ignore
|
|
141
141
|
Object.defineProperty(this, "router", {
|
|
@@ -196,20 +196,18 @@ class AdaptivePlaywrightCrawler extends playwright_crawler_1.PlaywrightCrawler {
|
|
|
196
196
|
}
|
|
197
197
|
crawlingContext.log.debug(`Running browser request handler for ${crawlingContext.request.url}`);
|
|
198
198
|
this.stats.trackBrowserRequestHandlerRun();
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
const oldStateCopy = JSON.parse(JSON.stringify(oldState));
|
|
205
|
-
const browserRun = await this.runRequestHandlerInBrowser(crawlingContext);
|
|
199
|
+
// Run the request handler in a browser. The copy of the crawler state is kept so that we can perform
|
|
200
|
+
// a rendering type detection if necessary. Without this measure, the HTTP request handler would run
|
|
201
|
+
// under different conditions, which could change its behavior. Changes done to the crawler state by
|
|
202
|
+
// the HTTP request handler will not be committed to the actual storage.
|
|
203
|
+
const { result: browserRun, initialStateCopy } = await this.runRequestHandlerInBrowser(crawlingContext);
|
|
206
204
|
if (!browserRun.ok) {
|
|
207
205
|
throw browserRun.error;
|
|
208
206
|
}
|
|
209
207
|
await this.commitResult(crawlingContext, browserRun.result);
|
|
210
208
|
if (shouldDetectRenderingType) {
|
|
211
209
|
crawlingContext.log.debug(`Detecting rendering type for ${crawlingContext.request.url}`);
|
|
212
|
-
const plainHTTPRun = await this.runRequestHandlerWithPlainHTTP(crawlingContext,
|
|
210
|
+
const plainHTTPRun = await this.runRequestHandlerWithPlainHTTP(crawlingContext, initialStateCopy);
|
|
213
211
|
const detectionResult = (() => {
|
|
214
212
|
if (!plainHTTPRun.ok) {
|
|
215
213
|
return 'clientOnly';
|
|
@@ -239,6 +237,7 @@ class AdaptivePlaywrightCrawler extends playwright_crawler_1.PlaywrightCrawler {
|
|
|
239
237
|
}
|
|
240
238
|
async runRequestHandlerInBrowser(crawlingContext) {
|
|
241
239
|
const result = new core_1.RequestHandlerResult(this.config, AdaptivePlaywrightCrawler.CRAWLEE_STATE_KEY);
|
|
240
|
+
let initialStateCopy;
|
|
242
241
|
try {
|
|
243
242
|
await super._runRequestHandler.call(new Proxy(this, {
|
|
244
243
|
get: (target, propertyName, receiver) => {
|
|
@@ -290,17 +289,23 @@ class AdaptivePlaywrightCrawler extends playwright_crawler_1.PlaywrightCrawler {
|
|
|
290
289
|
},
|
|
291
290
|
addRequests: result.addRequests,
|
|
292
291
|
pushData: result.pushData,
|
|
293
|
-
useState: this.allowStorageAccess(
|
|
292
|
+
useState: this.allowStorageAccess(async (defaultValue) => {
|
|
293
|
+
const state = await result.useState(defaultValue);
|
|
294
|
+
if (initialStateCopy === undefined) {
|
|
295
|
+
initialStateCopy = JSON.parse(JSON.stringify(state));
|
|
296
|
+
}
|
|
297
|
+
return state;
|
|
298
|
+
}),
|
|
294
299
|
getKeyValueStore: this.allowStorageAccess(result.getKeyValueStore),
|
|
295
300
|
}));
|
|
296
301
|
}
|
|
297
302
|
return Reflect.get(target, propertyName, receiver);
|
|
298
303
|
},
|
|
299
304
|
}), crawlingContext);
|
|
300
|
-
return { result, ok: true };
|
|
305
|
+
return { result: { result, ok: true }, initialStateCopy };
|
|
301
306
|
}
|
|
302
307
|
catch (error) {
|
|
303
|
-
return { error, ok: false };
|
|
308
|
+
return { result: { error, ok: false }, initialStateCopy };
|
|
304
309
|
}
|
|
305
310
|
}
|
|
306
311
|
async runRequestHandlerWithPlainHTTP(crawlingContext, oldStateCopy) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive-playwright-crawler.js","sourceRoot":"","sources":["../../src/internals/adaptive-playwright-crawler.ts"],"names":[],"mappings":";;;AA2mBA,wEAKC;;AA/mBD,8CAAuD;AAUvD,wCAAkH;AAElH,0CAA0E;AAC1E,qCAA2D;AAC3D,4EAAqC;AAIrC,4CAAqD;AAGrD,6DAAyD;AACzD,iFAA+F;AAkB/F,MAAM,mCAAoC,SAAQ,iBAAU;IAGxD,YAAY,UAA6B,EAAE;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHV;;;;mBAAiD,IAAW;WAAC,CAAC,+HAA+H;QAIlM,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAEQ,KAAK;QACV,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,CAAC,0BAA0B,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,yBAAyB,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,2BAA2B,GAAG,CAAC,CAAC;IAC/C,CAAC;IAEkB,KAAK,CAAC,oBAAoB;QACzC,MAAM,KAAK,CAAC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-
* A CSS selector matching elements to be clicked on. Unlike in {@
|
|
16
|
+
* A CSS selector matching elements to be clicked on. Unlike in {@link enqueueLinks}, there is no default
|
|
17
17
|
* value. This is to prevent suboptimal use of this function by using it too broadly.
|
|
18
18
|
*/
|
|
19
19
|
selector: string;
|
|
20
|
-
/** Sets {@
|
|
20
|
+
/** Sets {@link Request.userData} for newly enqueued requests. */
|
|
21
21
|
userData?: Dictionary;
|
|
22
|
-
/** Sets {@
|
|
22
|
+
/** Sets {@link Request.label} for newly enqueued requests. */
|
|
23
23
|
label?: string;
|
|
24
24
|
/**
|
|
25
25
|
* Click options for use in Playwright click handler.
|
|
@@ -30,7 +30,7 @@ export interface EnqueueLinksByClickingElementsOptions {
|
|
|
30
30
|
* containing glob pattern strings matching the URLs to be enqueued.
|
|
31
31
|
*
|
|
32
32
|
* The plain objects must include at least the `glob` property, which holds the glob pattern string.
|
|
33
|
-
* All remaining keys will be used as request options for the corresponding enqueued {@
|
|
33
|
+
* All remaining keys will be used as request options for the corresponding enqueued {@link Request} objects.
|
|
34
34
|
*
|
|
35
35
|
* The matching is always case-insensitive.
|
|
36
36
|
* If you need case-sensitive matching, use `regexps` property directly.
|
|
@@ -45,7 +45,7 @@ export interface EnqueueLinksByClickingElementsOptions {
|
|
|
45
45
|
* containing regular expressions matching the URLs to be enqueued.
|
|
46
46
|
*
|
|
47
47
|
* The plain objects must include at least the `regexp` property, which holds the regular expression.
|
|
48
|
-
* All remaining keys will be used as request options for the corresponding enqueued {@
|
|
48
|
+
* All remaining keys will be used as request options for the corresponding enqueued {@link Request} objects.
|
|
49
49
|
*
|
|
50
50
|
* If `regexps` is an empty array or `undefined`, then the function
|
|
51
51
|
* enqueues all the intercepted navigation requests produced by the page
|
|
@@ -56,11 +56,11 @@ export interface EnqueueLinksByClickingElementsOptions {
|
|
|
56
56
|
* *NOTE:* In future versions of SDK the options will be removed.
|
|
57
57
|
* Please use `globs` or `regexps` instead.
|
|
58
58
|
*
|
|
59
|
-
* An array of {@
|
|
60
|
-
* containing {@
|
|
59
|
+
* An array of {@link PseudoUrl} strings or plain objects
|
|
60
|
+
* containing {@link PseudoUrl} strings matching the URLs to be enqueued.
|
|
61
61
|
*
|
|
62
62
|
* The plain objects must include at least the `purl` property, which holds the pseudo-URL pattern string.
|
|
63
|
-
* All remaining keys will be used as request options for the corresponding enqueued {@
|
|
63
|
+
* All remaining keys will be used as request options for the corresponding enqueued {@link Request} objects.
|
|
64
64
|
*
|
|
65
65
|
* With a pseudo-URL string, the matching is always case-insensitive.
|
|
66
66
|
* If you need case-sensitive matching, use `regexps` property directly.
|
|
@@ -73,7 +73,7 @@ export interface EnqueueLinksByClickingElementsOptions {
|
|
|
73
73
|
*/
|
|
74
74
|
pseudoUrls?: PseudoUrlInput[];
|
|
75
75
|
/**
|
|
76
|
-
* Just before a new {@
|
|
76
|
+
* Just before a new {@link Request} is constructed and enqueued to the {@link RequestQueue}, this function can be used
|
|
77
77
|
* to remove it or modify its contents such as `userData`, `payload` or, most importantly `uniqueKey`. This is useful
|
|
78
78
|
* when you need to enqueue multiple `Requests` to the queue that share the same URL, but differ in methods or payloads,
|
|
79
79
|
* or to dynamically update or create `userData`.
|
|
@@ -121,7 +121,7 @@ export interface EnqueueLinksByClickingElementsOptions {
|
|
|
121
121
|
* If set to `true`:
|
|
122
122
|
* - while adding the request to the queue: the request will be added to the foremost position in the queue.
|
|
123
123
|
* - while reclaiming the request: the request will be placed to the beginning of the queue, so that it's returned
|
|
124
|
-
* in the next call to {@
|
|
124
|
+
* in the next call to {@link RequestQueue.fetchNextRequest}.
|
|
125
125
|
* By default, it's put to the end of the queue.
|
|
126
126
|
* @default false
|
|
127
127
|
*/
|
|
@@ -137,12 +137,12 @@ export interface EnqueueLinksByClickingElementsOptions {
|
|
|
137
137
|
* clicks all those elements using a mouse move and a left mouse button click and intercepts
|
|
138
138
|
* all the navigation requests that are subsequently produced by the page. The intercepted
|
|
139
139
|
* requests, including their methods, headers and payloads are then enqueued to a provided
|
|
140
|
-
* {@
|
|
140
|
+
* {@link RequestQueue}. This is useful to crawl JavaScript heavy pages where links are not available
|
|
141
141
|
* in `href` elements, but rather navigations are triggered in click handlers.
|
|
142
|
-
* If you're looking to find URLs in `href` attributes of the page, see {@
|
|
142
|
+
* If you're looking to find URLs in `href` attributes of the page, see {@link enqueueLinks}.
|
|
143
143
|
*
|
|
144
|
-
* Optionally, the function allows you to filter the target links' URLs using an array of {@
|
|
145
|
-
* and override settings of the enqueued {@
|
|
144
|
+
* Optionally, the function allows you to filter the target links' URLs using an array of {@link PseudoUrl} objects
|
|
145
|
+
* and override settings of the enqueued {@link Request} objects.
|
|
146
146
|
*
|
|
147
147
|
* **IMPORTANT**: To be able to do this, this function uses various mutations on the page,
|
|
148
148
|
* such as changing the Z-index of elements being clicked and their visibility. Therefore,
|
|
@@ -171,7 +171,7 @@ export interface EnqueueLinksByClickingElementsOptions {
|
|
|
171
171
|
* });
|
|
172
172
|
* ```
|
|
173
173
|
*
|
|
174
|
-
* @returns Promise that resolves to {@
|
|
174
|
+
* @returns Promise that resolves to {@link BatchAddRequestsResult} object.
|
|
175
175
|
*/
|
|
176
176
|
export declare function enqueueLinksByClickingElements(options: EnqueueLinksByClickingElementsOptions): Promise<BatchAddRequestsResult>;
|
|
177
177
|
interface WaitForPageIdleOptions {
|
|
@@ -15,12 +15,12 @@ const log = log_1.default.child({ prefix: 'Playwright Click Elements' });
|
|
|
15
15
|
* clicks all those elements using a mouse move and a left mouse button click and intercepts
|
|
16
16
|
* all the navigation requests that are subsequently produced by the page. The intercepted
|
|
17
17
|
* requests, including their methods, headers and payloads are then enqueued to a provided
|
|
18
|
-
* {@
|
|
18
|
+
* {@link RequestQueue}. This is useful to crawl JavaScript heavy pages where links are not available
|
|
19
19
|
* in `href` elements, but rather navigations are triggered in click handlers.
|
|
20
|
-
* If you're looking to find URLs in `href` attributes of the page, see {@
|
|
20
|
+
* If you're looking to find URLs in `href` attributes of the page, see {@link enqueueLinks}.
|
|
21
21
|
*
|
|
22
|
-
* Optionally, the function allows you to filter the target links' URLs using an array of {@
|
|
23
|
-
* and override settings of the enqueued {@
|
|
22
|
+
* Optionally, the function allows you to filter the target links' URLs using an array of {@link PseudoUrl} objects
|
|
23
|
+
* and override settings of the enqueued {@link Request} objects.
|
|
24
24
|
*
|
|
25
25
|
* **IMPORTANT**: To be able to do this, this function uses various mutations on the page,
|
|
26
26
|
* such as changing the Z-index of elements being clicked and their visibility. Therefore,
|
|
@@ -49,7 +49,7 @@ const log = log_1.default.child({ prefix: 'Playwright Click Elements' });
|
|
|
49
49
|
* });
|
|
50
50
|
* ```
|
|
51
51
|
*
|
|
52
|
-
* @returns Promise that resolves to {@
|
|
52
|
+
* @returns Promise that resolves to {@link BatchAddRequestsResult} object.
|
|
53
53
|
*/
|
|
54
54
|
async function enqueueLinksByClickingElements(options) {
|
|
55
55
|
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
@@ -18,14 +18,14 @@ export interface PlaywrightCrawlerOptions extends BrowserCrawlerOptions<Playwrig
|
|
|
18
18
|
browserPlugins: [PlaywrightPlugin];
|
|
19
19
|
}> {
|
|
20
20
|
/**
|
|
21
|
-
* The same options as used by {@
|
|
21
|
+
* The same options as used by {@link launchPlaywright}.
|
|
22
22
|
*/
|
|
23
23
|
launchContext?: PlaywrightLaunchContext;
|
|
24
24
|
/**
|
|
25
25
|
* Function that is called to process each request.
|
|
26
26
|
*
|
|
27
|
-
* The function receives the {@
|
|
28
|
-
* - `request` is an instance of the {@
|
|
27
|
+
* The function receives the {@link PlaywrightCrawlingContext} as an argument, where:
|
|
28
|
+
* - `request` is an instance of the {@link Request} object with details about the URL to open, HTTP method etc.
|
|
29
29
|
* - `page` is an instance of the `Playwright`
|
|
30
30
|
* [`Page`](https://playwright.dev/docs/api/class-page)
|
|
31
31
|
* - `browserController` is an instance of the
|
|
@@ -43,14 +43,14 @@ export interface PlaywrightCrawlerOptions extends BrowserCrawlerOptions<Playwrig
|
|
|
43
43
|
* To make this work, you should **always**
|
|
44
44
|
* let your function throw exceptions rather than catch them.
|
|
45
45
|
* The exceptions are logged to the request using the
|
|
46
|
-
* {@
|
|
46
|
+
* {@link Request.pushErrorMessage} function.
|
|
47
47
|
*/
|
|
48
48
|
requestHandler?: PlaywrightRequestHandler;
|
|
49
49
|
/**
|
|
50
50
|
* Function that is called to process each request.
|
|
51
51
|
*
|
|
52
|
-
* The function receives the {@
|
|
53
|
-
* - `request` is an instance of the {@
|
|
52
|
+
* The function receives the {@link PlaywrightCrawlingContext} as an argument, where:
|
|
53
|
+
* - `request` is an instance of the {@link Request} object with details about the URL to open, HTTP method etc.
|
|
54
54
|
* - `page` is an instance of the `Playwright`
|
|
55
55
|
* [`Page`](https://playwright.dev/docs/api/class-page)
|
|
56
56
|
* - `browserController` is an instance of the
|
|
@@ -68,7 +68,7 @@ export interface PlaywrightCrawlerOptions extends BrowserCrawlerOptions<Playwrig
|
|
|
68
68
|
* To make this work, you should **always**
|
|
69
69
|
* let your function throw exceptions rather than catch them.
|
|
70
70
|
* The exceptions are logged to the request using the
|
|
71
|
-
* {@
|
|
71
|
+
* {@link Request.pushErrorMessage} function.
|
|
72
72
|
*
|
|
73
73
|
* @deprecated `handlePageFunction` has been renamed to `requestHandler` and will be removed in a future version.
|
|
74
74
|
* @ignore
|
|
@@ -89,7 +89,7 @@ export interface PlaywrightCrawlerOptions extends BrowserCrawlerOptions<Playwrig
|
|
|
89
89
|
* ```
|
|
90
90
|
*
|
|
91
91
|
* Modyfing `pageOptions` is supported only in Playwright incognito.
|
|
92
|
-
* See {@
|
|
92
|
+
* See {@link PrePageCreateHook}
|
|
93
93
|
*/
|
|
94
94
|
preNavigationHooks?: PlaywrightHook[];
|
|
95
95
|
/**
|
|
@@ -117,27 +117,27 @@ export interface PlaywrightCrawlerOptions extends BrowserCrawlerOptions<Playwrig
|
|
|
117
117
|
*
|
|
118
118
|
* Since `Playwright` uses headless browser to download web pages and extract data,
|
|
119
119
|
* it is useful for crawling of websites that require to execute JavaScript.
|
|
120
|
-
* If the target website doesn't need JavaScript, consider using {@
|
|
120
|
+
* If the target website doesn't need JavaScript, consider using {@link CheerioCrawler},
|
|
121
121
|
* which downloads the pages using raw HTTP requests and is about 10x faster.
|
|
122
122
|
*
|
|
123
|
-
* The source URLs are represented using {@
|
|
124
|
-
* {@
|
|
125
|
-
* or {@
|
|
123
|
+
* The source URLs are represented using {@link Request} objects that are fed from
|
|
124
|
+
* {@link RequestList} or {@link RequestQueue} instances provided by the {@link PlaywrightCrawlerOptions.requestList}
|
|
125
|
+
* or {@link PlaywrightCrawlerOptions.requestQueue} constructor options, respectively.
|
|
126
126
|
*
|
|
127
|
-
* If both {@
|
|
128
|
-
* the instance first processes URLs from the {@
|
|
129
|
-
* to {@
|
|
127
|
+
* If both {@link PlaywrightCrawlerOptions.requestList} and {@link PlaywrightCrawlerOptions.requestQueue} are used,
|
|
128
|
+
* the instance first processes URLs from the {@link RequestList} and automatically enqueues all of them
|
|
129
|
+
* to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
|
|
130
130
|
*
|
|
131
|
-
* The crawler finishes when there are no more {@
|
|
131
|
+
* The crawler finishes when there are no more {@link Request} objects to crawl.
|
|
132
132
|
*
|
|
133
|
-
* `PlaywrightCrawler` opens a new Chrome page (i.e. tab) for each {@
|
|
134
|
-
* and then calls the function provided by user as the {@
|
|
133
|
+
* `PlaywrightCrawler` opens a new Chrome page (i.e. tab) for each {@link Request} object to crawl
|
|
134
|
+
* and then calls the function provided by user as the {@link PlaywrightCrawlerOptions.requestHandler} option.
|
|
135
135
|
*
|
|
136
136
|
* New pages are only opened when there is enough free CPU and memory available,
|
|
137
|
-
* using the functionality provided by the {@
|
|
138
|
-
* All {@
|
|
137
|
+
* using the functionality provided by the {@link AutoscaledPool} class.
|
|
138
|
+
* All {@link AutoscaledPool} configuration options can be passed to the {@link PlaywrightCrawlerOptions.autoscaledPoolOptions}
|
|
139
139
|
* parameter of the `PlaywrightCrawler` constructor. For user convenience, the `minConcurrency` and `maxConcurrency`
|
|
140
|
-
* {@
|
|
140
|
+
* {@link AutoscaledPoolOptions} are available directly in the `PlaywrightCrawler` constructor.
|
|
141
141
|
*
|
|
142
142
|
* Note that the pool of Playwright instances is internally managed by the [BrowserPool](https://github.com/apify/browser-pool) class.
|
|
143
143
|
*
|
|
@@ -269,9 +269,9 @@ export declare class PlaywrightCrawler extends BrowserCrawler<{
|
|
|
269
269
|
protected _navigationHandler(crawlingContext: PlaywrightCrawlingContext, gotoOptions: DirectNavigationOptions): Promise<Response | null>;
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
272
|
-
* Creates new {@
|
|
273
|
-
* This instance can then serve as a `requestHandler` of your {@
|
|
274
|
-
* Defaults to the {@
|
|
272
|
+
* Creates new {@link Router} instance that works based on request labels.
|
|
273
|
+
* This instance can then serve as a `requestHandler` of your {@link PlaywrightCrawler}.
|
|
274
|
+
* Defaults to the {@link PlaywrightCrawlingContext}.
|
|
275
275
|
*
|
|
276
276
|
* > Serves as a shortcut for using `Router.create<PlaywrightCrawlingContext>()`.
|
|
277
277
|
*
|
|
@@ -15,27 +15,27 @@ const playwright_utils_1 = require("./utils/playwright-utils");
|
|
|
15
15
|
*
|
|
16
16
|
* Since `Playwright` uses headless browser to download web pages and extract data,
|
|
17
17
|
* it is useful for crawling of websites that require to execute JavaScript.
|
|
18
|
-
* If the target website doesn't need JavaScript, consider using {@
|
|
18
|
+
* If the target website doesn't need JavaScript, consider using {@link CheerioCrawler},
|
|
19
19
|
* which downloads the pages using raw HTTP requests and is about 10x faster.
|
|
20
20
|
*
|
|
21
|
-
* The source URLs are represented using {@
|
|
22
|
-
* {@
|
|
23
|
-
* or {@
|
|
21
|
+
* The source URLs are represented using {@link Request} objects that are fed from
|
|
22
|
+
* {@link RequestList} or {@link RequestQueue} instances provided by the {@link PlaywrightCrawlerOptions.requestList}
|
|
23
|
+
* or {@link PlaywrightCrawlerOptions.requestQueue} constructor options, respectively.
|
|
24
24
|
*
|
|
25
|
-
* If both {@
|
|
26
|
-
* the instance first processes URLs from the {@
|
|
27
|
-
* to {@
|
|
25
|
+
* If both {@link PlaywrightCrawlerOptions.requestList} and {@link PlaywrightCrawlerOptions.requestQueue} are used,
|
|
26
|
+
* the instance first processes URLs from the {@link RequestList} and automatically enqueues all of them
|
|
27
|
+
* to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
|
|
28
28
|
*
|
|
29
|
-
* The crawler finishes when there are no more {@
|
|
29
|
+
* The crawler finishes when there are no more {@link Request} objects to crawl.
|
|
30
30
|
*
|
|
31
|
-
* `PlaywrightCrawler` opens a new Chrome page (i.e. tab) for each {@
|
|
32
|
-
* and then calls the function provided by user as the {@
|
|
31
|
+
* `PlaywrightCrawler` opens a new Chrome page (i.e. tab) for each {@link Request} object to crawl
|
|
32
|
+
* and then calls the function provided by user as the {@link PlaywrightCrawlerOptions.requestHandler} option.
|
|
33
33
|
*
|
|
34
34
|
* New pages are only opened when there is enough free CPU and memory available,
|
|
35
|
-
* using the functionality provided by the {@
|
|
36
|
-
* All {@
|
|
35
|
+
* using the functionality provided by the {@link AutoscaledPool} class.
|
|
36
|
+
* All {@link AutoscaledPool} configuration options can be passed to the {@link PlaywrightCrawlerOptions.autoscaledPoolOptions}
|
|
37
37
|
* parameter of the `PlaywrightCrawler` constructor. For user convenience, the `minConcurrency` and `maxConcurrency`
|
|
38
|
-
* {@
|
|
38
|
+
* {@link AutoscaledPoolOptions} are available directly in the `PlaywrightCrawler` constructor.
|
|
39
39
|
*
|
|
40
40
|
* Note that the pool of Playwright instances is internally managed by the [BrowserPool](https://github.com/apify/browser-pool) class.
|
|
41
41
|
*
|
|
@@ -129,9 +129,9 @@ Object.defineProperty(PlaywrightCrawler, "optionsShape", {
|
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
/**
|
|
132
|
-
* Creates new {@
|
|
133
|
-
* This instance can then serve as a `requestHandler` of your {@
|
|
134
|
-
* Defaults to the {@
|
|
132
|
+
* Creates new {@link Router} instance that works based on request labels.
|
|
133
|
+
* This instance can then serve as a `requestHandler` of your {@link PlaywrightCrawler}.
|
|
134
|
+
* Defaults to the {@link PlaywrightCrawlingContext}.
|
|
135
135
|
*
|
|
136
136
|
* > Serves as a shortcut for using `Router.create<PlaywrightCrawlingContext>()`.
|
|
137
137
|
*
|
|
@@ -132,7 +132,7 @@ export declare class PlaywrightLauncher extends BrowserLauncher<PlaywrightPlugin
|
|
|
132
132
|
* @param [launchContext]
|
|
133
133
|
* Optional settings passed to `browserType.launch()`. In addition to
|
|
134
134
|
* [Playwright's options](https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions)
|
|
135
|
-
* the object may contain our own {@
|
|
135
|
+
* the object may contain our own {@link PlaywrightLaunchContext} that enable additional features.
|
|
136
136
|
* @param [config]
|
|
137
137
|
* @returns
|
|
138
138
|
* Promise that resolves to Playwright's `Browser` instance.
|
|
@@ -93,7 +93,7 @@ function getDefaultExecutablePath(launchContext, config) {
|
|
|
93
93
|
* @param [launchContext]
|
|
94
94
|
* Optional settings passed to `browserType.launch()`. In addition to
|
|
95
95
|
* [Playwright's options](https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions)
|
|
96
|
-
* the object may contain our own {@
|
|
96
|
+
* the object may contain our own {@link PlaywrightLaunchContext} that enable additional features.
|
|
97
97
|
* @param [config]
|
|
98
98
|
* @returns
|
|
99
99
|
* Promise that resolves to Playwright's `Browser` instance.
|
|
@@ -184,7 +184,7 @@ export type CompiledScriptFunction = (params: CompiledScriptParams) => Promise<u
|
|
|
184
184
|
* }
|
|
185
185
|
* ```
|
|
186
186
|
* Where `page` is a Playwright [`Page`](https://playwright.dev/docs/api/class-page)
|
|
187
|
-
* and `request` is a {@
|
|
187
|
+
* and `request` is a {@link Request}.
|
|
188
188
|
*
|
|
189
189
|
* The function is compiled by using the `scriptString` parameter as the function's body,
|
|
190
190
|
* so any limitations to function bodies apply. Return value of the compiled function
|
|
@@ -277,7 +277,7 @@ export interface SaveSnapshotOptions {
|
|
|
277
277
|
*/
|
|
278
278
|
export declare function saveSnapshot(page: Page, options?: SaveSnapshotOptions): Promise<void>;
|
|
279
279
|
/**
|
|
280
|
-
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@
|
|
280
|
+
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@link CheerioCrawler}.
|
|
281
281
|
*
|
|
282
282
|
* **Example usage:**
|
|
283
283
|
* ```javascript
|
|
@@ -417,7 +417,7 @@ export interface PlaywrightContextUtils {
|
|
|
417
417
|
*/
|
|
418
418
|
waitForSelector(selector: string, timeoutMs?: number): Promise<void>;
|
|
419
419
|
/**
|
|
420
|
-
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@
|
|
420
|
+
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@link CheerioCrawler}.
|
|
421
421
|
* When provided with the `selector` argument, it waits for it to be available first.
|
|
422
422
|
*
|
|
423
423
|
* **Example usage:**
|
|
@@ -444,12 +444,12 @@ export interface PlaywrightContextUtils {
|
|
|
444
444
|
* clicks all those elements using a mouse move and a left mouse button click and intercepts
|
|
445
445
|
* all the navigation requests that are subsequently produced by the page. The intercepted
|
|
446
446
|
* requests, including their methods, headers and payloads are then enqueued to a provided
|
|
447
|
-
* {@
|
|
447
|
+
* {@link RequestQueue}. This is useful to crawl JavaScript heavy pages where links are not available
|
|
448
448
|
* in `href` elements, but rather navigations are triggered in click handlers.
|
|
449
|
-
* If you're looking to find URLs in `href` attributes of the page, see {@
|
|
449
|
+
* If you're looking to find URLs in `href` attributes of the page, see {@link enqueueLinks}.
|
|
450
450
|
*
|
|
451
|
-
* Optionally, the function allows you to filter the target links' URLs using an array of {@
|
|
452
|
-
* and override settings of the enqueued {@
|
|
451
|
+
* Optionally, the function allows you to filter the target links' URLs using an array of {@link PseudoUrl} objects
|
|
452
|
+
* and override settings of the enqueued {@link Request} objects.
|
|
453
453
|
*
|
|
454
454
|
* **IMPORTANT**: To be able to do this, this function uses various mutations on the page,
|
|
455
455
|
* such as changing the Z-index of elements being clicked and their visibility. Therefore,
|
|
@@ -478,7 +478,7 @@ export interface PlaywrightContextUtils {
|
|
|
478
478
|
* });
|
|
479
479
|
* ```
|
|
480
480
|
*
|
|
481
|
-
* @returns Promise that resolves to {@
|
|
481
|
+
* @returns Promise that resolves to {@link BatchAddRequestsResult} object.
|
|
482
482
|
*/
|
|
483
483
|
enqueueLinksByClickingElements(options: Omit<EnqueueLinksByClickingElementsOptions, 'page' | 'requestQueue'>): Promise<BatchAddRequestsResult>;
|
|
484
484
|
/**
|
|
@@ -491,7 +491,7 @@ export interface PlaywrightContextUtils {
|
|
|
491
491
|
* }
|
|
492
492
|
* ```
|
|
493
493
|
* Where `page` is a Playwright [`Page`](https://playwright.dev/docs/api/class-page)
|
|
494
|
-
* and `request` is a {@
|
|
494
|
+
* and `request` is a {@link Request}.
|
|
495
495
|
*
|
|
496
496
|
* The function is compiled by using the `scriptString` parameter as the function's body,
|
|
497
497
|
* so any limitations to function bodies apply. Return value of the compiled function
|
|
@@ -239,7 +239,7 @@ async function blockRequests(page, options = {}) {
|
|
|
239
239
|
* }
|
|
240
240
|
* ```
|
|
241
241
|
* Where `page` is a Playwright [`Page`](https://playwright.dev/docs/api/class-page)
|
|
242
|
-
* and `request` is a {@
|
|
242
|
+
* and `request` is a {@link Request}.
|
|
243
243
|
*
|
|
244
244
|
* The function is compiled by using the `scriptString` parameter as the function's body,
|
|
245
245
|
* so any limitations to function bodies apply. Return value of the compiled function
|
|
@@ -397,7 +397,7 @@ async function saveSnapshot(page, options = {}) {
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
/**
|
|
400
|
-
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@
|
|
400
|
+
* Returns Cheerio handle for `page.content()`, allowing to work with the data same way as with {@link CheerioCrawler}.
|
|
401
401
|
*
|
|
402
402
|
* **Example usage:**
|
|
403
403
|
* ```javascript
|