@crawlee/playwright 4.0.0-beta.11 → 4.0.0-beta.110

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.
Files changed (31) hide show
  1. package/README.md +17 -13
  2. package/index.d.ts +1 -2
  3. package/index.js +0 -1
  4. package/internals/adaptive-playwright-crawler.d.ts +106 -46
  5. package/internals/adaptive-playwright-crawler.js +301 -218
  6. package/internals/enqueue-links/click-elements.d.ts +37 -55
  7. package/internals/enqueue-links/click-elements.js +51 -43
  8. package/internals/playwright-crawler.d.ts +103 -55
  9. package/internals/playwright-crawler.js +48 -42
  10. package/internals/playwright-launcher.d.ts +6 -5
  11. package/internals/playwright-launcher.js +10 -11
  12. package/internals/utils/playwright-utils.d.ts +61 -24
  13. package/internals/utils/playwright-utils.js +100 -53
  14. package/internals/utils/rendering-type-prediction.d.ts +28 -13
  15. package/internals/utils/rendering-type-prediction.js +71 -29
  16. package/package.json +17 -13
  17. package/index.d.ts.map +0 -1
  18. package/index.js.map +0 -1
  19. package/internals/adaptive-playwright-crawler.d.ts.map +0 -1
  20. package/internals/adaptive-playwright-crawler.js.map +0 -1
  21. package/internals/enqueue-links/click-elements.d.ts.map +0 -1
  22. package/internals/enqueue-links/click-elements.js.map +0 -1
  23. package/internals/playwright-crawler.d.ts.map +0 -1
  24. package/internals/playwright-crawler.js.map +0 -1
  25. package/internals/playwright-launcher.d.ts.map +0 -1
  26. package/internals/playwright-launcher.js.map +0 -1
  27. package/internals/utils/playwright-utils.d.ts.map +0 -1
  28. package/internals/utils/playwright-utils.js.map +0 -1
  29. package/internals/utils/rendering-type-prediction.d.ts.map +0 -1
  30. package/internals/utils/rendering-type-prediction.js.map +0 -1
  31. package/tsconfig.build.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -1,19 +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://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/v/@crawlee/core.svg" alt="NPM latest version" data-canonical-src="https://img.shields.io/npm/v/@crawlee/core/next.svg" style="max-width: 100%;"></a>
14
- <a href="https://www.npmjs.com/package/@crawlee/core" rel="nofollow"><img src="https://img.shields.io/npm/dm/@crawlee/core.svg" alt="Downloads" data-canonical-src="https://img.shields.io/npm/dm/@crawlee/core.svg" style="max-width: 100%;"></a>
15
- <a href="https://discord.gg/jyEM2PRvMU" rel="nofollow"><img src="https://img.shields.io/discord/801163717915574323?label=discord" alt="Chat on discord" data-canonical-src="https://img.shields.io/discord/801163717915574323?label=discord" style="max-width: 100%;"></a>
16
- <a href="https://github.com/apify/crawlee/actions/workflows/test-ci.yml"><img src="https://github.com/apify/crawlee/actions/workflows/test-ci.yml/badge.svg?branch=master" alt="Build Status" style="max-width: 100%;"></a>
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
+ </p>
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" /></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>
17
21
  </p>
18
22
 
19
23
  Crawlee covers your crawling and scraping end-to-end and **helps you build reliable scrapers. Fast.**
@@ -24,7 +28,7 @@ Crawlee is available as the [`crawlee`](https://www.npmjs.com/package/crawlee) N
24
28
 
25
29
  > 👉 **View full documentation, guides and examples on the [Crawlee project website](https://crawlee.dev)** 👈
26
30
 
27
- > Crawlee for Python is open for early adopters. 🐍 [👉 Checkout the source code 👈](https://github.com/apify/crawlee-python).
31
+ > Do you prefer 🐍 Python instead of JavaScript? [👉 Checkout Crawlee for Python 👈](https://github.com/apify/crawlee-python).
28
32
 
29
33
  ## Installation
30
34
 
@@ -85,7 +89,7 @@ By default, Crawlee stores data to `./storage` in the current working directory.
85
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:
86
90
 
87
91
  ```bash
88
- npm install crawlee@3.12.3-beta.13
92
+ npm install crawlee@next
89
93
  ```
90
94
 
91
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:
@@ -94,9 +98,9 @@ If you also use the [Apify SDK](https://github.com/apify/apify-sdk-js), you need
94
98
  {
95
99
  "overrides": {
96
100
  "apify": {
97
- "@crawlee/core": "3.12.3-beta.13",
98
- "@crawlee/types": "3.12.3-beta.13",
99
- "@crawlee/utils": "3.12.3-beta.13"
101
+ "@crawlee/core": "$crawlee",
102
+ "@crawlee/types": "$crawlee",
103
+ "@crawlee/utils": "$crawlee"
100
104
  }
101
105
  }
102
106
  }
package/index.d.ts CHANGED
@@ -6,5 +6,4 @@ export { RenderingTypePredictor } from './internals/utils/rendering-type-predict
6
6
  export * as playwrightUtils from './internals/utils/playwright-utils.js';
7
7
  export * as playwrightClickElements from './internals/enqueue-links/click-elements.js';
8
8
  export type { DirectNavigationOptions as PlaywrightDirectNavigationOptions } from './internals/utils/playwright-utils.js';
9
- export type { RenderingType } from './internals/utils/rendering-type-prediction.js';
10
- //# sourceMappingURL=index.d.ts.map
9
+ export type { IRenderingTypePredictor, RenderingType } from './internals/utils/rendering-type-prediction.js';
package/index.js CHANGED
@@ -5,4 +5,3 @@ export * from './internals/adaptive-playwright-crawler.js';
5
5
  export { RenderingTypePredictor } from './internals/utils/rendering-type-prediction.js';
6
6
  export * as playwrightUtils from './internals/utils/playwright-utils.js';
7
7
  export * as playwrightClickElements from './internals/enqueue-links/click-elements.js';
8
- //# sourceMappingURL=index.js.map
@@ -1,15 +1,16 @@
1
+ import type { BrowserHook, LoadedRequest, Request, RouterHandler, RouteSchemas, RoutesFromSchemas } from '@crawlee/browser';
2
+ import type { BasicCrawlerOptions } from '@crawlee/basic';
1
3
  import { BasicCrawler } from '@crawlee/basic';
2
- import type { BasicCrawlerOptions, BrowserHook, LoadedRequest, Request } from '@crawlee/browser';
3
- import type { BaseHttpResponseData, CrawlingContext, EnqueueLinksOptions, GetUserDataFromRequest, RouterRoutes, StatisticsOptions, StatisticState } from '@crawlee/core';
4
- import { Configuration, RequestHandlerResult, Statistics } from '@crawlee/core';
5
- import type { Dictionary } from '@crawlee/types';
4
+ import type { ContextPipeline, CrawlingContext, EnqueueLinksOptions, GetUserDataFromRequest, RouterRoutes, StatisticsOptions, StatisticState, StorageTransactionView } from '@crawlee/core';
5
+ import { Statistics } from '@crawlee/core';
6
+ import type { Dictionary, Awaitable } from '@crawlee/types';
6
7
  import { type CheerioRoot } from '@crawlee/utils';
7
8
  import { type Cheerio } from 'cheerio';
8
9
  import type { AnyNode } from 'domhandler';
9
10
  // @ts-ignore optional peer dependency or compatibility with es2022
10
11
  import type { Page } from 'playwright';
11
12
  import type { PlaywrightCrawlingContext, PlaywrightGotoOptions } from './playwright-crawler.js';
12
- import { RenderingTypePredictor } from './utils/rendering-type-prediction.js';
13
+ import { type IRenderingTypePredictor } from './utils/rendering-type-prediction.js';
13
14
  interface AdaptivePlaywrightCrawlerStatisticState extends StatisticState {
14
15
  httpOnlyRequestHandlerRuns?: number;
15
16
  browserRequestHandlerRuns?: number;
@@ -19,26 +20,31 @@ declare class AdaptivePlaywrightCrawlerStatistics extends Statistics {
19
20
  state: AdaptivePlaywrightCrawlerStatisticState;
20
21
  constructor(options?: StatisticsOptions);
21
22
  reset(): void;
22
- protected _maybeLoadStatistics(): Promise<void>;
23
+ protected maybeLoadStatistics(): Promise<void>;
23
24
  trackHttpOnlyRequestHandlerRun(): void;
24
25
  trackBrowserRequestHandlerRun(): void;
25
26
  trackRenderingTypeMisprediction(): void;
26
27
  }
27
- export interface AdaptivePlaywrightCrawlerContext<UserData extends Dictionary = Dictionary> extends CrawlingContext<UserData> {
28
+ export interface AdaptivePlaywrightCrawlerContext<UserData extends Dictionary = any> extends CrawlingContext<UserData> {
28
29
  request: LoadedRequest<Request<UserData>>;
29
30
  /**
30
31
  * The HTTP response, either from the HTTP client or from the initial request from playwright's navigation.
31
32
  */
32
- response: BaseHttpResponseData;
33
+ response: Response;
33
34
  /**
34
35
  * Playwright Page object. If accessed in HTTP-only rendering, this will throw an error and make the AdaptivePlaywrightCrawlerContext retry the request in a browser.
35
36
  */
36
37
  page: Page;
37
38
  /**
38
- * Wait for an element matching the selector to appear and return a Cheerio object of matched elements.
39
+ * Wait for an element matching the selector to appear and return a Cheerio object of the first matched element.
39
40
  * Timeout defaults to 5s.
40
41
  */
41
42
  querySelector(selector: string, timeoutMs?: number): Promise<Cheerio<AnyNode>>;
43
+ /**
44
+ * Wait for an element matching the selector to appear and return a Cheerio object of all matched elements.
45
+ * Timeout defaults to 5s.
46
+ */
47
+ querySelectorAll(selector: string, timeoutMs?: number): Promise<Cheerio<AnyNode>>;
42
48
  /**
43
49
  * Wait for an element matching the selector to appear.
44
50
  * Timeout defaults to 5s.
@@ -66,53 +72,77 @@ export interface AdaptivePlaywrightCrawlerContext<UserData extends Dictionary =
66
72
  * ```
67
73
  */
68
74
  parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioRoot>;
69
- enqueueLinks(options?: EnqueueLinksOptions): Promise<void>;
75
+ enqueueLinks(options?: EnqueueLinksOptions): Promise<unknown>;
70
76
  }
71
- interface AdaptiveHook extends BrowserHook<Pick<AdaptivePlaywrightCrawlerContext, 'id' | 'session' | 'proxyInfo' | 'log'> & {
77
+ interface AdaptiveHookContext extends Pick<AdaptivePlaywrightCrawlerContext, 'id' | 'session' | 'proxyInfo' | 'log'> {
72
78
  page?: Page;
73
79
  request: Request;
74
- }, PlaywrightGotoOptions> {
80
+ gotoOptions?: PlaywrightGotoOptions;
75
81
  }
76
- export interface AdaptivePlaywrightCrawlerOptions<ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext> extends Omit<BasicCrawlerOptions<AdaptivePlaywrightCrawlerContext, ExtendedContext>, 'preNavigationHooks' | 'postNavigationHooks'> {
82
+ type AdaptiveHook<ContextExtension = Dictionary<never>> = BrowserHook<AdaptiveHookContext, ContextExtension>;
83
+ type AdaptivePostNavigationHook<ContextExtension = Dictionary<never>> = BrowserHook<Omit<AdaptiveHookContext, 'request'> & {
84
+ request: LoadedRequest<Request>;
85
+ }, ContextExtension>;
86
+ export interface AdaptivePlaywrightCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<AdaptivePlaywrightCrawlerContext['request']>>> extends Omit<BasicCrawlerOptions<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext, Routes>, 'preNavigationHooks' | 'postNavigationHooks'> {
77
87
  /**
78
88
  * Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies.
79
89
  * The function accepts a subset of the crawling context. If you attempt to access the `page` property during HTTP-only crawling,
80
90
  * an exception will be thrown. If it's not caught, the request will be transparently retried in a browser.
91
+ *
92
+ * A hook may optionally return a partial object whose properties are merged into the crawling context,
93
+ * allowing the hook to override context members for subsequent hooks and pipeline stages.
81
94
  */
82
- preNavigationHooks?: AdaptiveHook[];
95
+ preNavigationHooks?: AdaptiveHook<ContextExtension>[];
83
96
  /**
84
97
  * Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful.
85
98
  * The function accepts a subset of the crawling context. If you attempt to access the `page` property during HTTP-only crawling,
86
99
  * an exception will be thrown. If it's not caught, the request will be transparently retried in a browser.
100
+ *
101
+ * A hook may optionally return a partial object whose properties are merged into the crawling context
102
+ * (e.g. to override `response` after solving a challenge).
87
103
  */
88
- postNavigationHooks?: AdaptiveHook[];
104
+ postNavigationHooks?: AdaptivePostNavigationHook<ContextExtension>[];
89
105
  /**
90
106
  * Specifies the frequency of rendering type detection checks - 0.1 means roughly 10% of requests.
91
107
  * Defaults to 0.1 (so 10%).
92
108
  */
93
109
  renderingTypeDetectionRatio?: number;
94
110
  /**
95
- * An optional callback that is called on dataset items found by the request handler in plain HTTP mode.
111
+ * An optional callback that is called on the storage writes recorded by the request handler in plain
112
+ * HTTP mode (exposed as a read-only {@link StorageTransactionView}).
96
113
  * If it returns false, the request is retried in a browser.
97
- * If no callback is specified, every dataset item is considered valid.
114
+ * If no callback is specified, every result is considered valid.
98
115
  */
99
- resultChecker?: (result: RequestHandlerResult) => boolean;
116
+ resultChecker?: (result: StorageTransactionView) => boolean;
117
+ /**
118
+ * An optional callback that decides whether an error thrown during the plain HTTP request handler
119
+ * should be propagated (instead of falling back to browser navigation).
120
+ *
121
+ * If the callback returns `true`, the error is thrown, triggering the standard retry mechanism.
122
+ * If the callback returns `false` (or is not provided), the error is logged and the crawler
123
+ * falls back to browser navigation (default behavior).
124
+ *
125
+ * @default () => false
126
+ */
127
+ shouldPropagateError?: (error: Error, context: PlaywrightCrawlingContext) => Awaitable<boolean>;
100
128
  /**
101
129
  * An optional callback used in rendering type detection. On each detection, the result of the plain HTTP run is compared to that of the browser one.
102
- * If the callback returns true, the results are considered equal and the target site is considered static.
130
+ * If a callback is provided, the contract is as follows:
131
+ * It the callback returns true or 'equal', the results are considered equal and the target site is considered static.
132
+ * If it returns false or 'different', the target site is considered client-rendered.
133
+ * If it returns 'inconclusive', the detection result won't be used.
103
134
  * If no result comparator is specified, but there is a `resultChecker`, any site where the `resultChecker` returns true is considered static.
104
135
  * If neither `resultComparator` nor `resultChecker` are specified, a deep comparison of returned dataset items is used as a default.
136
+ *
137
+ * For a stricter, ready-made comparator that also takes enqueued requests and key-value store changes into account, see {@link fullResultComparator}.
105
138
  */
106
- resultComparator?: (resultA: RequestHandlerResult, resultB: RequestHandlerResult) => boolean;
107
- /**
108
- * A custom rendering type predictor
109
- */
110
- renderingTypePredictor?: Pick<RenderingTypePredictor, 'predict' | 'storeResult'>;
139
+ resultComparator?: (resultA: StorageTransactionView, resultB: StorageTransactionView) => boolean | 'equal' | 'different' | 'inconclusive';
111
140
  /**
112
- * Prevent direct access to storage in request handlers (only allow using context helpers).
113
- * Defaults to `true`
141
+ * A custom rendering type predictor. A predictor passed here is borrowed - the crawler never drives its
142
+ * lifecycle, so set it up yourself (the built-in {@link RenderingTypePredictor} needs `initialize()`).
143
+ * Omit the option and the crawler builds its own from `renderingTypeDetectionRatio` - and initializes it.
114
144
  */
115
- preventDirectStorageAccess?: boolean;
145
+ renderingTypePredictor?: IRenderingTypePredictor;
116
146
  }
117
147
  /**
118
148
  * 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.
@@ -143,29 +173,59 @@ export interface AdaptivePlaywrightCrawlerOptions<ExtendedContext extends Adapti
143
173
  *
144
174
  * @experimental
145
175
  */
146
- export declare class AdaptivePlaywrightCrawler<ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext> extends BasicCrawler<AdaptivePlaywrightCrawlerContext, ExtendedContext> {
147
- readonly config: Configuration;
148
- private renderingTypePredictor;
149
- private resultChecker;
150
- private resultComparator;
151
- private preventDirectStorageAccess;
152
- private staticContextPipeline;
153
- private browserContextPipeline;
154
- private individualRequestHandlerTimeoutMillis;
155
- readonly stats: AdaptivePlaywrightCrawlerStatistics;
156
- private resultObjects;
157
- private teardownHooks;
158
- constructor(options?: AdaptivePlaywrightCrawlerOptions<ExtendedContext>, config?: Configuration);
176
+ export declare class AdaptivePlaywrightCrawler<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<AdaptivePlaywrightCrawlerContext['request']>>> extends BasicCrawler<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext, Routes> {
177
+ #private;
178
+ get stats(): AdaptivePlaywrightCrawlerStatistics;
179
+ constructor(options?: AdaptivePlaywrightCrawlerOptions<ContextExtension, ExtendedContext, Routes>);
180
+ protected init(): Promise<void>;
181
+ protected buildContextPipeline(): ContextPipeline<CrawlingContext<Dictionary>, CrawlingContext<Dictionary> & {
182
+ readonly request: LoadedRequest<Request<Dictionary>>;
183
+ readonly response: Response;
184
+ readonly page: Page;
185
+ readonly querySelector: AdaptivePlaywrightCrawlerContext["querySelector"];
186
+ readonly querySelectorAll: AdaptivePlaywrightCrawlerContext["querySelectorAll"];
187
+ readonly waitForSelector: AdaptivePlaywrightCrawlerContext["waitForSelector"];
188
+ readonly parseWithCheerio: AdaptivePlaywrightCrawlerContext["parseWithCheerio"];
189
+ }>;
159
190
  private adaptCheerioContext;
160
191
  private adaptPlaywrightContext;
192
+ /**
193
+ * Runs one request handler attempt inside its own {@link StorageTransaction}, wrapping the inner
194
+ * (static or browser) context pipeline. The transaction is pushed to `transactions` *at creation
195
+ * time, before the `try`* - the `ok: false` branch of the returned {@link Result} carries no
196
+ * result, and failed attempts are routine here. The caller owns the outcome and disposal.
197
+ */
161
198
  private crawlOne;
162
- protected runRequestHandler(crawlingContext: PlaywrightCrawlingContext): Promise<void>;
163
- protected commitResult(crawlingContext: PlaywrightCrawlingContext, { calls, keyValueStoreChanges }: RequestHandlerResult): Promise<void>;
164
- protected allowStorageAccess<R, TArgs extends any[]>(func: (...args: TArgs) => Promise<R>): (...args: TArgs) => Promise<R>;
199
+ protected runRequestHandler(crawlingContext: CrawlingContext): Promise<void>;
200
+ private enqueueLinks;
165
201
  private createLogProxy;
166
202
  teardown(): Promise<void>;
167
203
  }
168
- // @ts-ignore optional peer dependency or compatibility with es2022
169
- export declare function createAdaptivePlaywrightRouter<Context extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, UserData>): import("@crawlee/basic").RouterHandler<Context>;
204
+ export declare function createAdaptivePlaywrightRouter<Context extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<Context['request']>>>(routes?: RouterRoutes<Context, Routes>): RouterHandler<Context, Routes>;
205
+ export declare function createAdaptivePlaywrightRouter<Context extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, Record<string, UserData>>): RouterHandler<Context, Record<string, UserData>>;
206
+ export declare function createAdaptivePlaywrightRouter<Context extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext, const Schemas extends RouteSchemas = RouteSchemas>(schemas: Schemas): RouterHandler<Context, RoutesFromSchemas<Schemas>>;
207
+ /**
208
+ * An opt-in {@link AdaptivePlaywrightCrawlerOptions.resultComparator|`resultComparator`} that considers two
209
+ * request handler results equal only if *all* of their observable effects match - the pushed dataset items, the
210
+ * enqueued requests, and the key-value store changes. This is stricter than the default comparator, which only
211
+ * compares dataset items.
212
+ *
213
+ * **Beware:** enqueued URLs are compared exactly. The same page rendered in a browser and via plain HTTP often
214
+ * yields links that differ only in tracking query parameters, for example:
215
+ * - `https://sdk.apify.com/docs/guides/getting-started`
216
+ * - `https://sdk.apify.com/docs/guides/getting-started?__hsfp=1136113150&__hssc=7591405.1.173549427712`
217
+ *
218
+ * Such links are treated as *different*, which will make the crawler favor browser rendering for those pages.
219
+ *
220
+ * **Example usage:**
221
+ * ```ts
222
+ * const crawler = new AdaptivePlaywrightCrawler({
223
+ * resultComparator: fullResultComparator,
224
+ * async requestHandler({ pushData, enqueueLinks }) {
225
+ * // ...
226
+ * },
227
+ * });
228
+ * ```
229
+ */
230
+ export declare function fullResultComparator(resultA: StorageTransactionView, resultB: StorageTransactionView): boolean;
170
231
  export {};
171
- //# sourceMappingURL=adaptive-playwright-crawler.d.ts.map