@crawlee/cheerio 3.0.3-beta.11 → 3.0.3-beta.14

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/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from '@crawlee/basic';
1
+ export * from '@crawlee/http';
2
2
  export * from './internals/cheerio-crawler';
3
3
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC"}
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@crawlee/basic"), exports);
4
+ tslib_1.__exportStar(require("@crawlee/http"), exports);
5
5
  tslib_1.__exportStar(require("./internals/cheerio-crawler"), exports);
6
6
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,sEAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,sEAA4C"}
package/index.mjs CHANGED
@@ -16,6 +16,7 @@ export const EVENT_SESSION_RETIRED = mod.EVENT_SESSION_RETIRED;
16
16
  export const EnqueueStrategy = mod.EnqueueStrategy;
17
17
  export const EventManager = mod.EventManager;
18
18
  export const EventType = mod.EventType;
19
+ export const HttpCrawler = mod.HttpCrawler;
19
20
  export const KeyValueStore = mod.KeyValueStore;
20
21
  export const LocalEventManager = mod.LocalEventManager;
21
22
  export const Log = mod.Log;
@@ -54,6 +55,7 @@ export const cookieStringToToughCookie = mod.cookieStringToToughCookie;
54
55
  export const createBasicRouter = mod.createBasicRouter;
55
56
  export const createCheerioRouter = mod.createCheerioRouter;
56
57
  export const createDeserialize = mod.createDeserialize;
58
+ export const createHttpRouter = mod.createHttpRouter;
57
59
  export const createRequestOptions = mod.createRequestOptions;
58
60
  export const createRequests = mod.createRequests;
59
61
  export const deserializeArray = mod.deserializeArray;
@@ -1,219 +1,24 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- import type { BasicCrawlerOptions, ErrorHandler, RequestHandler } from '@crawlee/basic';
4
- import { BasicCrawler } from '@crawlee/basic';
5
- import type { CrawlingContext, EnqueueLinksOptions, ProxyConfiguration, Request, RequestQueue, Session } from '@crawlee/core';
6
- import { CrawlerExtension, Configuration } from '@crawlee/core';
7
- import type { BatchAddRequestsResult, Awaitable, Dictionary } from '@crawlee/types';
8
- import type { CheerioRoot } from '@crawlee/utils';
9
- import type { RequestLike, ResponseLike } from 'content-type';
10
- import type { OptionsInit, Response as GotResponse, GotOptionsInit } from 'got-scraping';
2
+ import type { HttpCrawlerOptions, InternalHttpCrawlingContext, InternalHttpHook, ErrorHandler, RequestHandler, EnqueueLinksOptions, RequestQueue, Configuration } from '@crawlee/http';
3
+ import { HttpCrawler } from '@crawlee/http';
4
+ import type { BatchAddRequestsResult, Dictionary } from '@crawlee/types';
5
+ import * as cheerio from 'cheerio';
11
6
  import type { IncomingMessage } from 'http';
12
7
  export declare type CheerioErrorHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
13
8
  JSONData extends Dictionary = Dictionary> = ErrorHandler<CheerioCrawlingContext<UserData, JSONData>>;
14
9
  export interface CheerioCrawlerOptions<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
15
- JSONData extends Dictionary = Dictionary> extends Omit<BasicCrawlerOptions<CheerioCrawlingContext<UserData, JSONData>>, 'requestHandler' | 'handleRequestFunction' | 'failedRequestHandler' | 'handleFailedRequestFunction' | 'handleRequestTimeoutSecs' | 'errorHandler'> {
16
- /**
17
- * User-provided function that performs the logic of the crawler. It is called for each page
18
- * loaded and parsed by the crawler.
19
- *
20
- * The function receives the {@apilink CheerioCrawlingContext} as an argument,
21
- * where the {@apilink CheerioCrawlingContext.request} instance represents the URL to crawl.
22
- *
23
- * Type of {@apilink CheerioCrawlingContext.body} depends on the `Content-Type` header of the web page:
24
- * - String for `text/html`, `application/xhtml+xml`, `application/xml` MIME content types
25
- * - Buffer for others MIME content types
26
- *
27
- * Parsed `Content-Type` header using
28
- * [content-type package](https://www.npmjs.com/package/content-type)
29
- * is stored in {@apilink CheerioCrawlingContext.contentType}`.
30
- *
31
- * Cheerio is available only for HTML and XML content types.
32
- *
33
- * If the function returns, the returned promise is awaited by the crawler.
34
- *
35
- * If the function throws an exception, the crawler will try to re-crawl the
36
- * request later, up to `option.maxRequestRetries` times.
37
- * If all the retries fail, the crawler calls the function
38
- * provided to the `failedRequestHandler` parameter.
39
- * To make this work, you should **always**
40
- * let your function throw exceptions rather than catch them.
41
- * The exceptions are logged to the request using the
42
- * {@apilink Request.pushErrorMessage} function.
43
- */
44
- requestHandler?: CheerioRequestHandler<UserData, JSONData>;
45
- /**
46
- * User-provided function that performs the logic of the crawler. It is called for each page
47
- * loaded and parsed by the crawler.
48
- *
49
- * The function receives the {@apilink CheerioCrawlingContext} as an argument,
50
- * where the {@apilink CheerioCrawlingContext.request} instance represents the URL to crawl.
51
- *
52
- * Type of {@apilink CheerioCrawlingContext.body} depends on the `Content-Type` header of the web page:
53
- * - String for `text/html`, `application/xhtml+xml`, `application/xml` MIME content types
54
- * - Buffer for others MIME content types
55
- *
56
- * Parsed `Content-Type` header using
57
- * [content-type package](https://www.npmjs.com/package/content-type)
58
- * is stored in {@apilink CheerioCrawlingContext.contentType}`.
59
- *
60
- * Cheerio is available only for HTML and XML content types.
61
- *
62
- * If the function returns, the returned promise is awaited by the crawler.
63
- *
64
- * If the function throws an exception, the crawler will try to re-crawl the
65
- * request later, up to `option.maxRequestRetries` times.
66
- * If all the retries fail, the crawler calls the function
67
- * provided to the `failedRequestHandler` parameter.
68
- * To make this work, you should **always**
69
- * let your function throw exceptions rather than catch them.
70
- * The exceptions are logged to the request using the
71
- * {@apilink Request.pushErrorMessage} function.
72
- *
73
- * @deprecated `handlePageFunction` has been renamed to `requestHandler` and will be removed in a future version.
74
- * @ignore
75
- */
76
- handlePageFunction?: CheerioRequestHandler<UserData, JSONData>;
77
- /**
78
- * Timeout in which the HTTP request to the resource needs to finish, given in seconds.
79
- */
80
- navigationTimeoutSecs?: number;
81
- /**
82
- * If set to true, SSL certificate errors will be ignored.
83
- */
84
- ignoreSslErrors?: boolean;
85
- /**
86
- * If set, `CheerioCrawler` will be configured for all connections to use
87
- * [Apify Proxy](https://console.apify.com/proxy) or your own Proxy URLs provided and rotated according to the configuration.
88
- * For more information, see the [documentation](https://docs.apify.com/proxy).
89
- */
90
- proxyConfiguration?: ProxyConfiguration;
91
- /**
92
- * User-provided function that allows modifying the request object before it gets retried by the crawler.
93
- * It's executed before each retry for the requests that failed less than `option.maxRequestRetries` times.
94
- *
95
- * The function receives the {@apilink CheerioCrawlingContext} as the first argument,
96
- * where the {@apilink CheerioCrawlingContext.request} corresponds to the request to be retried.
97
- * Second argument is the `Error` instance that
98
- * represents the last error thrown during processing of the request.
99
- */
100
- errorHandler?: CheerioErrorHandler<UserData, JSONData>;
101
- /**
102
- * A function to handle requests that failed more than `option.maxRequestRetries` times.
103
- *
104
- * The function receives the {@apilink CheerioCrawlingContext} as the first argument,
105
- * where the {@apilink CheerioCrawlingContext.request} corresponds to the failed request.
106
- * Second argument is the `Error` instance that
107
- * represents the last error thrown during processing of the request.
108
- *
109
- * See [source code](https://github.com/apify/crawlee/blob/master/src/crawlers/cheerio_crawler.js#L13)
110
- * for the default implementation of this function.
111
- */
112
- failedRequestHandler?: CheerioErrorHandler<UserData, JSONData>;
113
- /**
114
- * A function to handle requests that failed more than `option.maxRequestRetries` times.
115
- *
116
- * The function receives the {@apilink CheerioCrawlingContext} as the first argument,
117
- * where the {@apilink CheerioCrawlingContext.request} corresponds to the failed request.
118
- * Second argument is the `Error` instance that
119
- * represents the last error thrown during processing of the request.
120
- *
121
- * See [source code](https://github.com/apify/crawlee/blob/master/src/crawlers/cheerio_crawler.js#L13)
122
- * for the default implementation of this function.
123
- *
124
- * @deprecated `handleFailedRequestFunction` has been renamed to `failedRequestHandler` and will be removed in a future version.
125
- * @ignore
126
- */
127
- handleFailedRequestFunction?: CheerioErrorHandler<UserData, JSONData>;
128
- /**
129
- * Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies
130
- * or browser properties before navigation. The function accepts two parameters, `crawlingContext` and `gotOptions`,
131
- * which are passed to the `requestAsBrowser()` function the crawler calls to navigate.
132
- * Example:
133
- * ```
134
- * preNavigationHooks: [
135
- * async (crawlingContext, gotOptions) => {
136
- * // ...
137
- * },
138
- * ]
139
- * ```
140
- */
141
- preNavigationHooks?: CheerioHook<UserData, JSONData>[];
142
- /**
143
- * Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful.
144
- * The function accepts `crawlingContext` as the only parameter.
145
- * Example:
146
- * ```
147
- * postNavigationHooks: [
148
- * async (crawlingContext) => {
149
- * // ...
150
- * },
151
- * ]
152
- * ```
153
- */
154
- postNavigationHooks?: CheerioHook<UserData, JSONData>[];
155
- /**
156
- * An array of [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types)
157
- * you want the crawler to load and process. By default, only `text/html` and `application/xhtml+xml` MIME types are supported.
158
- */
159
- additionalMimeTypes?: string[];
160
- /**
161
- * By default `CheerioCrawler` will extract correct encoding from the HTTP response headers.
162
- * Sadly, there are some websites which use invalid headers. Those are encoded using the UTF-8 encoding.
163
- * If those sites actually use a different encoding, the response will be corrupted. You can use
164
- * `suggestResponseEncoding` to fall back to a certain encoding, if you know that your target website uses it.
165
- * To force a certain encoding, disregarding the response headers, use {@apilink CheerioCrawlerOptions.forceResponseEncoding}
166
- * ```
167
- * // Will fall back to windows-1250 encoding if none found
168
- * suggestResponseEncoding: 'windows-1250'
169
- * ```
170
- */
171
- suggestResponseEncoding?: string;
172
- /**
173
- * By default `CheerioCrawler` will extract correct encoding from the HTTP response headers. Use `forceResponseEncoding`
174
- * to force a certain encoding, disregarding the response headers.
175
- * To only provide a default for missing encodings, use {@apilink CheerioCrawlerOptions.suggestResponseEncoding}
176
- * ```
177
- * // Will force windows-1250 encoding even if headers say otherwise
178
- * forceResponseEncoding: 'windows-1250'
179
- * ```
180
- */
181
- forceResponseEncoding?: string;
182
- /**
183
- * Automatically saves cookies to Session. Works only if Session Pool is used.
184
- *
185
- * It parses cookie from response "set-cookie" header saves or updates cookies for session and once the session is used for next request.
186
- * It passes the "Cookie" header to the request with the session cookies.
187
- */
188
- persistCookiesPerSession?: boolean;
10
+ JSONData extends Dictionary = Dictionary> extends HttpCrawlerOptions<CheerioCrawlingContext<UserData, JSONData>> {
189
11
  }
190
12
  export declare type CheerioHook<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
191
- JSONData extends Dictionary = Dictionary> = (crawlingContext: CheerioCrawlingContext<UserData, JSONData>, gotOptions: OptionsInit) => Awaitable<void>;
13
+ JSONData extends Dictionary = Dictionary> = InternalHttpHook<CheerioCrawlingContext<UserData, JSONData>>;
192
14
  export interface CheerioCrawlingContext<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
193
- JSONData extends Dictionary = Dictionary> extends CrawlingContext<UserData> {
15
+ JSONData extends Dictionary = Dictionary> extends InternalHttpCrawlingContext<UserData, JSONData, CheerioCrawler> {
194
16
  /**
195
17
  * The [Cheerio](https://cheerio.js.org/) object with parsed HTML.
18
+ * Cheerio is available only for HTML and XML content types.
196
19
  */
197
- $: CheerioRoot;
198
- /**
199
- * The request body of the web page.
200
- */
201
- body: (string | Buffer);
202
- /**
203
- * The parsed object from JSON string if the response contains the content type application/json.
204
- */
205
- json: JSONData;
206
- /**
207
- * Parsed `Content-Type header: { type, encoding }`.
208
- */
209
- contentType: {
210
- type: string;
211
- encoding: string;
212
- };
213
- crawler: CheerioCrawler;
214
- response: IncomingMessage;
20
+ $: cheerio.CheerioAPI;
215
21
  enqueueLinks: (options?: CheerioCrawlerEnqueueLinksOptions) => Promise<BatchAddRequestsResult>;
216
- sendRequest: (overrideOptions?: Partial<GotOptionsInit>) => Promise<GotResponse<string>>;
217
22
  }
218
23
  export declare type CheerioRequestHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
219
24
  JSONData extends Dictionary = Dictionary> = RequestHandler<CheerioCrawlingContext<UserData, JSONData>>;
@@ -260,7 +65,7 @@ export interface CheerioCrawlerEnqueueLinksOptions extends Omit<EnqueueLinksOpti
260
65
  * and skips pages with other content types. If you want the crawler to process other content types,
261
66
  * use the {@apilink CheerioCrawlerOptions.additionalMimeTypes} constructor option.
262
67
  * Beware that the parsing behavior differs for HTML, XML, JSON and other types of content.
263
- * For details, see {@apilink CheerioCrawlerOptions.requestHandler}.
68
+ * For more details, see {@apilink CheerioCrawlerOptions.requestHandler}.
264
69
  *
265
70
  * New requests are only dispatched when there is enough free CPU and memory available,
266
71
  * using the functionality provided by the {@apilink AutoscaledPool} class.
@@ -296,139 +101,28 @@ export interface CheerioCrawlerEnqueueLinksOptions extends Omit<EnqueueLinksOpti
296
101
  * ```
297
102
  * @category Crawlers
298
103
  */
299
- export declare class CheerioCrawler extends BasicCrawler<CheerioCrawlingContext> {
300
- readonly config: Configuration;
301
- /**
302
- * A reference to the underlying {@apilink ProxyConfiguration} class that manages the crawler's proxies.
303
- * Only available if used by the crawler.
304
- */
305
- proxyConfiguration?: ProxyConfiguration;
306
- protected userRequestHandlerTimeoutMillis: number;
307
- protected preNavigationHooks: CheerioHook[];
308
- protected postNavigationHooks: CheerioHook[];
309
- protected persistCookiesPerSession: boolean;
310
- protected navigationTimeoutMillis: number;
311
- protected ignoreSslErrors: boolean;
312
- protected suggestResponseEncoding?: string;
313
- protected forceResponseEncoding?: string;
314
- protected readonly supportedMimeTypes: Set<string>;
315
- protected static optionsShape: {
316
- handlePageFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
317
- navigationTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
318
- ignoreSslErrors: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
319
- additionalMimeTypes: import("ow").ArrayPredicate<string>;
320
- suggestResponseEncoding: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
321
- forceResponseEncoding: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
322
- proxyConfiguration: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
323
- persistCookiesPerSession: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
324
- preNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
325
- postNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
326
- requestList: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
327
- requestQueue: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
328
- requestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
329
- handleRequestFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
330
- requestHandlerTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
331
- handleRequestTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
332
- errorHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
333
- failedRequestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
334
- handleFailedRequestFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
335
- maxRequestRetries: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
336
- maxRequestsPerCrawl: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
337
- autoscaledPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
338
- sessionPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
339
- useSessionPool: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
340
- minConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
341
- maxConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
342
- maxRequestsPerMinute: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
343
- log: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
344
- };
104
+ export declare class CheerioCrawler extends HttpCrawler<CheerioCrawlingContext> {
345
105
  /**
346
106
  * All `CheerioCrawler` parameters are passed via an options object.
347
107
  */
348
108
  constructor(options?: CheerioCrawlerOptions, config?: Configuration);
349
- /**
350
- * **EXPERIMENTAL**
351
- * Function for attaching CrawlerExtensions such as the Unblockers.
352
- * @param extension Crawler extension that overrides the crawler configuration.
353
- */
354
- use(extension: CrawlerExtension): void;
355
- /**
356
- * Wrapper around requestHandler that opens and closes pages etc.
357
- */
358
- protected _runRequestHandler(crawlingContext: CheerioCrawlingContext): Promise<void>;
359
- protected _handleNavigation(crawlingContext: CheerioCrawlingContext): Promise<void>;
360
- /**
361
- * Sets the cookie header to `gotOptions` based on the provided request and session headers, as well as any changes that occurred due to hooks.
362
- */
363
- private _applyCookies;
364
- /**
365
- * Function to make the HTTP request. It performs optimizations
366
- * on the request such as only downloading the request body if the
367
- * received content type matches text/html, application/xml, application/xhtml+xml.
368
- */
369
- protected _requestFunction({ request, session, proxyUrl, gotOptions }: RequestFunctionOptions): Promise<IncomingMessage>;
370
- /**
371
- * Encodes and parses response according to the provided content type
372
- */
373
- protected _parseResponse(request: Request, responseStream: IncomingMessage): Promise<{
109
+ protected _parseHTML(response: IncomingMessage, isXml: boolean, crawlingContext: CheerioCrawlingContext): Promise<{
374
110
  dom: unknown;
375
- isXml: boolean;
376
- response: IncomingMessage;
377
- contentType: {
378
- type: string;
379
- encoding: BufferEncoding;
380
- };
381
- body?: undefined;
382
- } | {
383
- body: Buffer;
384
- response: IncomingMessage;
385
- contentType: {
386
- type: string;
387
- encoding: BufferEncoding;
388
- };
389
- dom?: undefined;
390
- isXml?: undefined;
111
+ $: cheerio.CheerioAPI;
112
+ readonly body: string;
113
+ enqueueLinks: (enqueueOptions?: CheerioCrawlerEnqueueLinksOptions) => Promise<BatchAddRequestsResult>;
391
114
  }>;
392
- /**
393
- * Combines the provided `requestOptions` with mandatory (non-overridable) values.
394
- */
395
- protected _getRequestOptions(request: Request, session?: Session, proxyUrl?: string, gotOptions?: OptionsInit): OptionsInit & {
396
- isStream: true;
397
- };
398
- protected _encodeResponse(request: Request, response: IncomingMessage, encoding: BufferEncoding): {
399
- encoding: BufferEncoding;
400
- response: IncomingMessage;
401
- };
402
115
  protected _parseHtmlToDom(response: IncomingMessage): Promise<unknown>;
403
- /**
404
- * Checks and extends supported mime types
405
- */
406
- protected _extendSupportedMimeTypes(additionalMimeTypes: (string | RequestLike | ResponseLike)[]): void;
407
- /**
408
- * Handles timeout request
409
- */
410
- protected _handleRequestTimeout(session?: Session): void;
411
- private _abortDownloadOfBody;
412
- /**
413
- * @internal wraps public utility for mocking purposes
414
- */
415
- private _requestAsBrowser;
416
116
  }
417
117
  interface EnqueueLinksInternalOptions {
418
118
  options?: CheerioCrawlerEnqueueLinksOptions;
419
- $: CheerioRoot | null;
119
+ $: cheerio.CheerioAPI | null;
420
120
  requestQueue: RequestQueue;
421
121
  originalRequestUrl: string;
422
122
  finalRequestUrl?: string;
423
123
  }
424
124
  /** @internal */
425
125
  export declare function cheerioCrawlerEnqueueLinks({ options, $, requestQueue, originalRequestUrl, finalRequestUrl }: EnqueueLinksInternalOptions): Promise<BatchAddRequestsResult>;
426
- interface RequestFunctionOptions {
427
- request: Request;
428
- session?: Session;
429
- proxyUrl?: string;
430
- gotOptions: OptionsInit;
431
- }
432
126
  /**
433
127
  * Creates new {@apilink Router} instance that works based on request labels.
434
128
  * This instance can then serve as a `requestHandler` of your {@apilink CheerioCrawler}.
@@ -453,6 +147,6 @@ interface RequestFunctionOptions {
453
147
  * await crawler.run();
454
148
  * ```
455
149
  */
456
- export declare function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext>(): import("@crawlee/basic").RouterHandler<Context>;
150
+ export declare function createCheerioRouter<Context extends CheerioCrawlingContext = CheerioCrawlingContext>(): import("@crawlee/http").RouterHandler<Context>;
457
151
  export {};
458
152
  //# sourceMappingURL=cheerio-crawler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cheerio-crawler.d.ts","sourceRoot":"","sources":["../../src/internals/cheerio-crawler.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,EAAyB,mBAAmB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,YAAY,EAAqC,MAAM,gBAAgB,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC9H,OAAO,EAAE,gBAAgB,EAA0F,aAAa,EAAE,MAAM,eAAe,CAAC;AACxJ,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAiC,QAAQ,IAAI,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA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