@crawlee/cheerio 3.0.0-alpha.3 → 3.0.0-alpha.32
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/{dist/README.md → README.md} +0 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.d.ts.map → index.d.ts.map} +0 -0
- package/{dist/index.js → index.js} +0 -0
- package/{dist/index.js.map → index.js.map} +0 -0
- package/{dist/index.mjs → index.mjs} +1 -4
- package/{dist/internals → internals}/cheerio-crawler.d.ts +23 -95
- package/internals/cheerio-crawler.d.ts.map +1 -0
- package/{dist/internals → internals}/cheerio-crawler.js +74 -130
- package/internals/cheerio-crawler.js.map +1 -0
- package/package.json +8 -12
- package/tsconfig.build.tsbuildinfo +1 -0
- package/dist/LICENSE.md +0 -201
- package/dist/internals/cheerio-crawler.d.ts.map +0 -1
- package/dist/internals/cheerio-crawler.js.map +0 -1
- package/dist/package.json +0 -63
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -39,7 +39,6 @@ export const Snapshotter = mod.Snapshotter;
|
|
|
39
39
|
export const Statistics = mod.Statistics;
|
|
40
40
|
export const StorageManager = mod.StorageManager;
|
|
41
41
|
export const SystemStatus = mod.SystemStatus;
|
|
42
|
-
export const basicCrawlerEnqueueLinks = mod.basicCrawlerEnqueueLinks;
|
|
43
42
|
export const checkAndSerialize = mod.checkAndSerialize;
|
|
44
43
|
export const cheerioCrawlerEnqueueLinks = mod.cheerioCrawlerEnqueueLinks;
|
|
45
44
|
export const chunkBySize = mod.chunkBySize;
|
|
@@ -58,11 +57,9 @@ export const handleRequestTimeout = mod.handleRequestTimeout;
|
|
|
58
57
|
export const log = mod.log;
|
|
59
58
|
export const maybeStringify = mod.maybeStringify;
|
|
60
59
|
export const mergeCookies = mod.mergeCookies;
|
|
61
|
-
export const
|
|
62
|
-
export const pushData = mod.pushData;
|
|
60
|
+
export const resolveBaseUrl = mod.resolveBaseUrl;
|
|
63
61
|
export const serializeArray = mod.serializeArray;
|
|
64
62
|
export const storage = mod.storage;
|
|
65
|
-
export const throwOnBlockedRequest = mod.throwOnBlockedRequest;
|
|
66
63
|
export const updateEnqueueLinksPatternCache = mod.updateEnqueueLinksPatternCache;
|
|
67
64
|
export const validateGlobPattern = mod.validateGlobPattern;
|
|
68
65
|
export const validators = mod.validators;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { BasicCrawler, BasicCrawlerOptions } from '@crawlee/basic';
|
|
3
3
|
import { CrawlerExtension, CrawlerHandleFailedRequestInput, CrawlingContext, EnqueueLinksOptions, ProxyConfiguration, ProxyInfo, Request, RequestQueue, Session, storage } from '@crawlee/core';
|
|
4
|
-
import { Awaitable, CheerioRoot } from '@crawlee/utils';
|
|
4
|
+
import { Awaitable, CheerioRoot, Dictionary } from '@crawlee/utils';
|
|
5
5
|
import { RequestLike, ResponseLike } from 'content-type';
|
|
6
6
|
import { OptionsInit } from 'got-scraping';
|
|
7
7
|
import { IncomingMessage } from 'http';
|
|
8
|
-
export interface CheerioFailedRequestHandlerInput<JSONData =
|
|
8
|
+
export interface CheerioFailedRequestHandlerInput<JSONData = Dictionary> extends CrawlerHandleFailedRequestInput, CheerioRequestHandlerInputs<JSONData> {
|
|
9
9
|
}
|
|
10
|
-
export declare type CheerioFailedRequestHandler<JSONData =
|
|
11
|
-
export interface CheerioCrawlerOptions<JSONData =
|
|
10
|
+
export declare type CheerioFailedRequestHandler<JSONData = Dictionary> = (inputs: CheerioFailedRequestHandlerInput<JSONData>) => Awaitable<void>;
|
|
11
|
+
export interface CheerioCrawlerOptions<JSONData = Dictionary> extends Omit<BasicCrawlerOptions<CheerioCrawlingContext<JSONData>>, 'requestHandler' | 'handleRequestFunction' | 'failedRequestHandler' | 'handleFailedRequestFunction' | 'handleRequestTimeoutSecs'> {
|
|
12
12
|
/**
|
|
13
13
|
* User-provided function that performs the logic of the crawler. It is called for each page
|
|
14
14
|
* loaded and parsed by the crawler.
|
|
@@ -133,61 +133,6 @@ export interface CheerioCrawlerOptions<JSONData = unknown> extends Omit<BasicCra
|
|
|
133
133
|
* @deprecated `handlePageFunction` has been renamed to `requestHandler` and will be removed in a future version.
|
|
134
134
|
*/
|
|
135
135
|
handlePageFunction?: CheerioRequestHandler<JSONData>;
|
|
136
|
-
/**
|
|
137
|
-
* > This option is deprecated, use `preNavigationHooks` instead.
|
|
138
|
-
*
|
|
139
|
-
* A function that executes before the HTTP request is made to the target resource.
|
|
140
|
-
* This function is suitable for setting dynamic properties such as cookies to the {@link Request}.
|
|
141
|
-
*
|
|
142
|
-
* The function receives the following object as an argument:
|
|
143
|
-
* ```
|
|
144
|
-
* {
|
|
145
|
-
* request: Request,
|
|
146
|
-
* session: Session,
|
|
147
|
-
* proxyInfo: ProxyInfo,
|
|
148
|
-
* crawler: CheerioCrawler,
|
|
149
|
-
* }
|
|
150
|
-
* ```
|
|
151
|
-
* where the {@link Request} instance corresponds to the initialized request
|
|
152
|
-
* and the {@link Session} instance corresponds to used session.
|
|
153
|
-
*
|
|
154
|
-
* The function should modify the properties of the passed {@link Request} instance
|
|
155
|
-
* in place because there are already earlier references to it. Making a copy and returning it from
|
|
156
|
-
* this function is therefore not supported, because it would create inconsistencies where
|
|
157
|
-
* different parts of SDK would have access to a different {@link Request} instance.
|
|
158
|
-
*/
|
|
159
|
-
prepareRequestFunction?: PrepareRequest<JSONData>;
|
|
160
|
-
/**
|
|
161
|
-
* > This option is deprecated, use `postNavigationHooks` instead.
|
|
162
|
-
*
|
|
163
|
-
* A function that executes right after the HTTP request is made to the target resource and response is returned.
|
|
164
|
-
* This function is suitable for overriding custom properties of response e.g. setting headers because of response parsing.
|
|
165
|
-
*
|
|
166
|
-
* **Example usage:**
|
|
167
|
-
*
|
|
168
|
-
* ```javascript
|
|
169
|
-
* const cheerioCrawlerOptions = {
|
|
170
|
-
* // ...
|
|
171
|
-
* postResponseFunction: ({ request, response }) => {
|
|
172
|
-
* if (request.userData.parseAsJSON) {
|
|
173
|
-
* response.headers['content-type'] = 'application/json; charset=utf-8';
|
|
174
|
-
* }
|
|
175
|
-
* }
|
|
176
|
-
* }
|
|
177
|
-
* ```
|
|
178
|
-
* The function receives the following object as an argument:
|
|
179
|
-
* ```
|
|
180
|
-
* {
|
|
181
|
-
* response: Object,
|
|
182
|
-
* request: Request,
|
|
183
|
-
* session: Session,
|
|
184
|
-
* proxyInfo: ProxyInfo,
|
|
185
|
-
* crawler: CheerioCrawler,
|
|
186
|
-
* }
|
|
187
|
-
* ```
|
|
188
|
-
* The response is an instance of Node's http.IncomingMessage object.
|
|
189
|
-
*/
|
|
190
|
-
postResponseFunction?: PostResponse<JSONData>;
|
|
191
136
|
/**
|
|
192
137
|
* Timeout in which the HTTP request to the resource needs to finish, given in seconds.
|
|
193
138
|
*/
|
|
@@ -314,7 +259,7 @@ export interface CheerioCrawlerOptions<JSONData = unknown> extends Omit<BasicCra
|
|
|
314
259
|
*/
|
|
315
260
|
persistCookiesPerSession?: boolean;
|
|
316
261
|
}
|
|
317
|
-
export interface PrepareRequestInputs<JSONData =
|
|
262
|
+
export interface PrepareRequestInputs<JSONData = Dictionary> {
|
|
318
263
|
/**
|
|
319
264
|
* Original instance of the {@link Request} object. Must be modified in-place.
|
|
320
265
|
*/
|
|
@@ -330,9 +275,9 @@ export interface PrepareRequestInputs<JSONData = unknown> {
|
|
|
330
275
|
proxyInfo?: ProxyInfo;
|
|
331
276
|
crawler?: CheerioCrawler<JSONData>;
|
|
332
277
|
}
|
|
333
|
-
export declare type PrepareRequest<JSONData =
|
|
334
|
-
export declare type CheerioHook<JSONData =
|
|
335
|
-
export interface PostResponseInputs<JSONData =
|
|
278
|
+
export declare type PrepareRequest<JSONData = Dictionary> = (inputs: PrepareRequestInputs<JSONData>) => Awaitable<void>;
|
|
279
|
+
export declare type CheerioHook<JSONData = Dictionary> = (crawlingContext: CheerioCrawlingContext<JSONData>, gotOptions: OptionsInit) => Awaitable<void>;
|
|
280
|
+
export interface PostResponseInputs<JSONData = Dictionary> {
|
|
336
281
|
/**
|
|
337
282
|
* stream
|
|
338
283
|
*/
|
|
@@ -352,8 +297,8 @@ export interface PostResponseInputs<JSONData = unknown> {
|
|
|
352
297
|
proxyInfo?: ProxyInfo;
|
|
353
298
|
crawler: CheerioCrawler<JSONData>;
|
|
354
299
|
}
|
|
355
|
-
export declare type PostResponse<JSONData =
|
|
356
|
-
export interface CheerioRequestHandlerInputs<JSONData =
|
|
300
|
+
export declare type PostResponse<JSONData = Dictionary> = (inputs: PostResponseInputs<JSONData>) => Awaitable<void>;
|
|
301
|
+
export interface CheerioRequestHandlerInputs<JSONData = Dictionary> extends CrawlingContext {
|
|
357
302
|
/**
|
|
358
303
|
* The [Cheerio](https://cheerio.js.org/) object with parsed HTML.
|
|
359
304
|
*/
|
|
@@ -377,8 +322,8 @@ export interface CheerioRequestHandlerInputs<JSONData = unknown> extends Crawlin
|
|
|
377
322
|
response: IncomingMessage;
|
|
378
323
|
enqueueLinks: (options?: CheerioCrawlerEnqueueLinksOptions) => Promise<storage.BatchAddRequestsResult>;
|
|
379
324
|
}
|
|
380
|
-
export declare type CheerioCrawlingContext<JSONData =
|
|
381
|
-
export declare type CheerioRequestHandler<JSONData =
|
|
325
|
+
export declare type CheerioCrawlingContext<JSONData = Dictionary> = CheerioRequestHandlerInputs<JSONData>;
|
|
326
|
+
export declare type CheerioRequestHandler<JSONData = Dictionary> = (inputs: CheerioRequestHandlerInputs<JSONData>) => Awaitable<void>;
|
|
382
327
|
export declare type CheerioCrawlerEnqueueLinksOptions = Omit<EnqueueLinksOptions, 'urls' | 'requestQueue'>;
|
|
383
328
|
/**
|
|
384
329
|
* Provides a framework for the parallel crawling of web pages using plain HTTP requests and
|
|
@@ -465,16 +410,13 @@ export declare type CheerioCrawlerEnqueueLinksOptions = Omit<EnqueueLinksOptions
|
|
|
465
410
|
* ```
|
|
466
411
|
* @category Crawlers
|
|
467
412
|
*/
|
|
468
|
-
export declare class CheerioCrawler<JSONData =
|
|
413
|
+
export declare class CheerioCrawler<JSONData = Dictionary> extends BasicCrawler<CheerioCrawlingContext<JSONData>, CheerioFailedRequestHandlerInput<JSONData>> {
|
|
469
414
|
/**
|
|
470
415
|
* A reference to the underlying {@link ProxyConfiguration} class that manages the crawler's proxies.
|
|
471
416
|
* Only available if used by the crawler.
|
|
472
417
|
*/
|
|
473
418
|
proxyConfiguration?: ProxyConfiguration;
|
|
474
419
|
protected userRequestHandlerTimeoutMillis: number;
|
|
475
|
-
protected defaultGotoOptions: {
|
|
476
|
-
timeout: number;
|
|
477
|
-
};
|
|
478
420
|
protected preNavigationHooks: CheerioHook<JSONData>[];
|
|
479
421
|
protected postNavigationHooks: CheerioHook<JSONData>[];
|
|
480
422
|
protected persistCookiesPerSession: boolean;
|
|
@@ -482,8 +424,6 @@ export declare class CheerioCrawler<JSONData = unknown> extends BasicCrawler<Che
|
|
|
482
424
|
protected ignoreSslErrors: boolean;
|
|
483
425
|
protected suggestResponseEncoding?: string;
|
|
484
426
|
protected forceResponseEncoding?: string;
|
|
485
|
-
protected prepareRequestFunction?: PrepareRequest<JSONData>;
|
|
486
|
-
protected postResponseFunction?: PostResponse<JSONData>;
|
|
487
427
|
protected readonly supportedMimeTypes: Set<string>;
|
|
488
428
|
protected static optionsShape: {
|
|
489
429
|
handlePageFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
@@ -493,8 +433,6 @@ export declare class CheerioCrawler<JSONData = unknown> extends BasicCrawler<Che
|
|
|
493
433
|
suggestResponseEncoding: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
|
|
494
434
|
forceResponseEncoding: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
|
|
495
435
|
proxyConfiguration: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
496
|
-
prepareRequestFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
497
|
-
postResponseFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
498
436
|
persistCookiesPerSession: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
|
|
499
437
|
preNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
|
|
500
438
|
postNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
|
|
@@ -503,7 +441,10 @@ export declare class CheerioCrawler<JSONData = unknown> extends BasicCrawler<Che
|
|
|
503
441
|
requestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
504
442
|
handleRequestFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
505
443
|
requestHandlerTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
506
|
-
handleRequestTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
444
|
+
handleRequestTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>; /**
|
|
445
|
+
* An object with information about currently used proxy by the crawler
|
|
446
|
+
* and configured by the {@link ProxyConfiguration} class.
|
|
447
|
+
*/
|
|
507
448
|
failedRequestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
508
449
|
handleFailedRequestFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
509
450
|
maxRequestRetries: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
@@ -531,25 +472,15 @@ export declare class CheerioCrawler<JSONData = unknown> extends BasicCrawler<Che
|
|
|
531
472
|
protected _runRequestHandler(crawlingContext: CheerioCrawlingContext<JSONData>): Promise<void>;
|
|
532
473
|
protected _handleNavigation(crawlingContext: CheerioCrawlingContext<JSONData>): Promise<void>;
|
|
533
474
|
/**
|
|
534
|
-
*
|
|
535
|
-
* as `request.headers` are already merged into the `gotOptions`. This method is using
|
|
536
|
-
* old `request.headers` snapshot (before hooks are executed), makes a diff with the cookie value
|
|
537
|
-
* after hooks are executed, and merges any new cookies back to `gotOptions`.
|
|
538
|
-
*
|
|
539
|
-
* This way we can still use both `gotOptions` and `context.request` in the hooks (not both).
|
|
475
|
+
* Sets the cookie header to `gotOptions` based on the provided request and session headers, as well as any changes that occurred due to hooks.
|
|
540
476
|
*/
|
|
541
|
-
private
|
|
477
|
+
private _applyCookies;
|
|
542
478
|
/**
|
|
543
479
|
* Function to make the HTTP request. It performs optimizations
|
|
544
480
|
* on the request such as only downloading the request body if the
|
|
545
481
|
* received content type matches text/html, application/xml, application/xhtml+xml.
|
|
546
482
|
*/
|
|
547
483
|
protected _requestFunction({ request, session, proxyUrl, gotOptions }: RequestFunctionOptions): Promise<IncomingMessage>;
|
|
548
|
-
/**
|
|
549
|
-
* Sets the cookie header to `gotOptions` based on provided session and request. If some cookies were already set,
|
|
550
|
-
* the session cookie will be merged with them. User provided cookies on `request` object have precedence.
|
|
551
|
-
*/
|
|
552
|
-
private _applySessionCookie;
|
|
553
484
|
/**
|
|
554
485
|
* Encodes and parses response according to the provided content type
|
|
555
486
|
*/
|
|
@@ -587,10 +518,6 @@ export declare class CheerioCrawler<JSONData = unknown> extends BasicCrawler<Che
|
|
|
587
518
|
* Checks and extends supported mime types
|
|
588
519
|
*/
|
|
589
520
|
protected _extendSupportedMimeTypes(additionalMimeTypes: (string | RequestLike | ResponseLike)[]): void;
|
|
590
|
-
/**
|
|
591
|
-
* Handles blocked request
|
|
592
|
-
*/
|
|
593
|
-
protected _throwOnBlockedRequest(session: Session, statusCode: number): void;
|
|
594
521
|
/**
|
|
595
522
|
* Handles timeout request
|
|
596
523
|
*/
|
|
@@ -604,11 +531,12 @@ export declare class CheerioCrawler<JSONData = unknown> extends BasicCrawler<Che
|
|
|
604
531
|
interface EnqueueLinksInternalOptions {
|
|
605
532
|
options?: CheerioCrawlerEnqueueLinksOptions;
|
|
606
533
|
$: CheerioRoot | null;
|
|
607
|
-
requestQueue
|
|
608
|
-
|
|
534
|
+
requestQueue: RequestQueue;
|
|
535
|
+
originalRequestUrl: string;
|
|
536
|
+
finalRequestUrl?: string;
|
|
609
537
|
}
|
|
610
538
|
/** @internal */
|
|
611
|
-
export declare function cheerioCrawlerEnqueueLinks({ options, $, requestQueue,
|
|
539
|
+
export declare function cheerioCrawlerEnqueueLinks({ options, $, requestQueue, originalRequestUrl, finalRequestUrl }: EnqueueLinksInternalOptions): Promise<storage.BatchAddRequestsResult>;
|
|
612
540
|
interface RequestFunctionOptions {
|
|
613
541
|
request: Request;
|
|
614
542
|
session?: Session;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cheerio-crawler.d.ts","sourceRoot":"","sources":["../../src/internals/cheerio-crawler.ts"],"names":[],"mappings":";AAEA,OAAO,EACH,YAAY,EACZ,mBAAmB,EAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,gBAAgB,EAChB,+BAA+B,EAC/B,eAAe,EAEf,mBAAmB,EAEnB,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,YAAY,EAEZ,OAAO,EACP,OAAO,EAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAyC,MAAM,gBAAgB,CAAC;AAE3G,OAA0B,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAe,WAAW,EAA+C,MAAM,cAAc,CAAC;AAGrG,OAAO,EAAuB,eAAe,EAAE,MAAM,MAAM,CAAC;AAoB5D,MAAM,WAAW,gCAAgC,CAAC,QAAQ,GAAG,UAAU,CAAE,SAAQ,+BAA+B,EAAE,2BAA2B,CAAC,QAAQ,CAAC;CAAG;AAE1J,oBAAY,2BAA2B,CAAC,QAAQ,GAAG,UAAU,IAAI,CAAC,MAAM,EAAE,gCAAgC,CAAC,QAAQ,CAAC,KAAK,SAAS,CAA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AM,GAAG,WAAW,GAAG,YAAY,CAAC,EAAE;IAWhG;;OAEG;IACH,SAAS,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,OAAO;IAKjD,OAAO,CAAC,oBAAoB;IAgB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB,CASvB;CACL;AAED,UAAU,2BAA2B;IACjC,OAAO,CAAC,EAAE,iCAAiC,CAAC;IAC5C,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,gBAAgB;AAChB,wBAAsB,0BAA0B,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,EAAE,2BAA2B,2CAoB9I;AAED,UAAU,sBAAsB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,WAAW,CAAC;CAC3B"}
|
|
@@ -120,7 +120,7 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
120
120
|
*/
|
|
121
121
|
constructor(options) {
|
|
122
122
|
(0, ow_1.default)(options, 'CheerioCrawlerOptions', ow_1.default.object.exactShape(CheerioCrawler.optionsShape));
|
|
123
|
-
const { requestHandler, handlePageFunction, requestHandlerTimeoutSecs = 60, requestTimeoutSecs = 30, ignoreSslErrors = true, additionalMimeTypes = [], suggestResponseEncoding, forceResponseEncoding, proxyConfiguration,
|
|
123
|
+
const { requestHandler, handlePageFunction, requestHandlerTimeoutSecs = 60, requestTimeoutSecs = 30, ignoreSslErrors = true, additionalMimeTypes = [], suggestResponseEncoding, forceResponseEncoding, proxyConfiguration, persistCookiesPerSession, preNavigationHooks = [], postNavigationHooks = [],
|
|
124
124
|
// Ignored
|
|
125
125
|
handleRequestFunction,
|
|
126
126
|
// BasicCrawler
|
|
@@ -150,12 +150,6 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
150
150
|
writable: true,
|
|
151
151
|
value: void 0
|
|
152
152
|
});
|
|
153
|
-
Object.defineProperty(this, "defaultGotoOptions", {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
configurable: true,
|
|
156
|
-
writable: true,
|
|
157
|
-
value: void 0
|
|
158
|
-
});
|
|
159
153
|
Object.defineProperty(this, "preNavigationHooks", {
|
|
160
154
|
enumerable: true,
|
|
161
155
|
configurable: true,
|
|
@@ -198,18 +192,6 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
198
192
|
writable: true,
|
|
199
193
|
value: void 0
|
|
200
194
|
});
|
|
201
|
-
Object.defineProperty(this, "prepareRequestFunction", {
|
|
202
|
-
enumerable: true,
|
|
203
|
-
configurable: true,
|
|
204
|
-
writable: true,
|
|
205
|
-
value: void 0
|
|
206
|
-
});
|
|
207
|
-
Object.defineProperty(this, "postResponseFunction", {
|
|
208
|
-
enumerable: true,
|
|
209
|
-
configurable: true,
|
|
210
|
-
writable: true,
|
|
211
|
-
value: void 0
|
|
212
|
-
});
|
|
213
195
|
Object.defineProperty(this, "supportedMimeTypes", {
|
|
214
196
|
enumerable: true,
|
|
215
197
|
configurable: true,
|
|
@@ -255,8 +237,6 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
255
237
|
this.ignoreSslErrors = ignoreSslErrors;
|
|
256
238
|
this.suggestResponseEncoding = suggestResponseEncoding;
|
|
257
239
|
this.forceResponseEncoding = forceResponseEncoding;
|
|
258
|
-
this.prepareRequestFunction = prepareRequestFunction;
|
|
259
|
-
this.postResponseFunction = postResponseFunction;
|
|
260
240
|
this.proxyConfiguration = proxyConfiguration;
|
|
261
241
|
this.preNavigationHooks = preNavigationHooks;
|
|
262
242
|
this.postNavigationHooks = [
|
|
@@ -301,103 +281,88 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
301
281
|
const { request, session } = crawlingContext;
|
|
302
282
|
if (this.proxyConfiguration) {
|
|
303
283
|
const sessionId = session ? session.id : undefined;
|
|
304
|
-
crawlingContext.proxyInfo = this.proxyConfiguration.newProxyInfo(sessionId);
|
|
305
|
-
}
|
|
306
|
-
await this._handleNavigation(crawlingContext);
|
|
307
|
-
(0, timeout_1.tryCancel)();
|
|
308
|
-
const { dom, isXml, body, contentType, response } = await this._parseResponse(request, crawlingContext.response);
|
|
309
|
-
(0, timeout_1.tryCancel)();
|
|
310
|
-
if (this.useSessionPool) {
|
|
311
|
-
this._throwOnBlockedRequest(session, response.statusCode);
|
|
284
|
+
crawlingContext.proxyInfo = await this.proxyConfiguration.newProxyInfo(sessionId);
|
|
312
285
|
}
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
286
|
+
if (!request.skipNavigation) {
|
|
287
|
+
await this._handleNavigation(crawlingContext);
|
|
288
|
+
(0, timeout_1.tryCancel)();
|
|
289
|
+
const { dom, isXml, body, contentType, response } = await this._parseResponse(request, crawlingContext.response);
|
|
290
|
+
(0, timeout_1.tryCancel)();
|
|
291
|
+
if (this.useSessionPool) {
|
|
292
|
+
this._throwOnBlockedRequest(session, response.statusCode);
|
|
293
|
+
}
|
|
294
|
+
if (this.persistCookiesPerSession) {
|
|
295
|
+
session.setCookiesFromResponse(response);
|
|
296
|
+
}
|
|
297
|
+
request.loadedUrl = response.url;
|
|
298
|
+
const $ = dom
|
|
299
|
+
? cheerio_1.default.load(dom, {
|
|
300
|
+
xmlMode: isXml,
|
|
301
|
+
// Recent versions of cheerio use parse5 as the HTML parser/serializer. It's more strict than htmlparser2
|
|
302
|
+
// and not good for scraping. It also does not have a great streaming interface.
|
|
303
|
+
// Here we tell cheerio to use htmlparser2 for serialization, otherwise the conflict produces weird errors.
|
|
304
|
+
_useHtmlParser2: true,
|
|
305
|
+
})
|
|
306
|
+
: null;
|
|
307
|
+
crawlingContext.$ = $;
|
|
308
|
+
crawlingContext.contentType = contentType;
|
|
309
|
+
crawlingContext.response = response;
|
|
310
|
+
crawlingContext.enqueueLinks = async (enqueueOptions) => {
|
|
311
|
+
return cheerioCrawlerEnqueueLinks({
|
|
312
|
+
options: enqueueOptions,
|
|
313
|
+
$,
|
|
314
|
+
requestQueue: await this.getRequestQueue(),
|
|
315
|
+
originalRequestUrl: crawlingContext.request.url,
|
|
316
|
+
finalRequestUrl: crawlingContext.request.loadedUrl,
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
Object.defineProperty(crawlingContext, 'json', {
|
|
320
|
+
get() {
|
|
321
|
+
if (contentType.type !== APPLICATION_JSON_MIME_TYPE)
|
|
322
|
+
return null;
|
|
323
|
+
const jsonString = body.toString(contentType.encoding);
|
|
324
|
+
return JSON.parse(jsonString);
|
|
325
|
+
},
|
|
335
326
|
});
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
// This is to save memory for high-concurrency crawls. The downside is that changes
|
|
349
|
-
// made to DOM are reflected in the HTML, but we can live with that...
|
|
350
|
-
if (dom) {
|
|
351
|
-
return isXml ? $.xml() : $.html({ decodeEntities: false });
|
|
352
|
-
}
|
|
353
|
-
return body;
|
|
354
|
-
},
|
|
355
|
-
});
|
|
327
|
+
Object.defineProperty(crawlingContext, 'body', {
|
|
328
|
+
get() {
|
|
329
|
+
// NOTE: For XML/HTML documents, we don't store the original body and only reconstruct it from Cheerio's DOM.
|
|
330
|
+
// This is to save memory for high-concurrency crawls. The downside is that changes
|
|
331
|
+
// made to DOM are reflected in the HTML, but we can live with that...
|
|
332
|
+
if (dom) {
|
|
333
|
+
return isXml ? $.xml() : $.html({ decodeEntities: false });
|
|
334
|
+
}
|
|
335
|
+
return body;
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
}
|
|
356
339
|
return (0, timeout_1.addTimeoutToPromise)(() => Promise.resolve(this.requestHandler(crawlingContext)), this.userRequestHandlerTimeoutMillis, `requestHandler timed out after ${this.userRequestHandlerTimeoutMillis / 1000} seconds.`);
|
|
357
340
|
}
|
|
358
341
|
async _handleNavigation(crawlingContext) {
|
|
359
|
-
if (this.prepareRequestFunction) {
|
|
360
|
-
this.log.deprecated('Option "prepareRequestFunction" is deprecated. Use "preNavigationHooks" instead.');
|
|
361
|
-
await this.prepareRequestFunction(crawlingContext);
|
|
362
|
-
(0, timeout_1.tryCancel)();
|
|
363
|
-
}
|
|
364
342
|
const gotOptions = {};
|
|
365
|
-
if (this.useSessionPool) {
|
|
366
|
-
this._applySessionCookie(crawlingContext, gotOptions);
|
|
367
|
-
}
|
|
368
343
|
const { request, session } = crawlingContext;
|
|
369
|
-
const
|
|
344
|
+
const preNavigationHooksCookies = this._getCookieHeaderFromRequest(request);
|
|
345
|
+
// Execute pre navigation hooks before applying session pool cookies,
|
|
346
|
+
// as they may also set cookies in the session
|
|
370
347
|
await this._executeHooks(this.preNavigationHooks, crawlingContext, gotOptions);
|
|
371
348
|
(0, timeout_1.tryCancel)();
|
|
349
|
+
const postNavigationHooksCookies = this._getCookieHeaderFromRequest(request);
|
|
350
|
+
this._applyCookies(crawlingContext, gotOptions, preNavigationHooksCookies, postNavigationHooksCookies);
|
|
372
351
|
const proxyUrl = crawlingContext.proxyInfo?.url;
|
|
373
|
-
this._mergeRequestCookieDiff(request, cookieSnapshot, gotOptions);
|
|
374
352
|
crawlingContext.response = await (0, timeout_1.addTimeoutToPromise)(() => this._requestFunction({ request, session, proxyUrl, gotOptions }), this.requestTimeoutMillis, `request timed out after ${this.requestTimeoutMillis / 1000} seconds.`);
|
|
375
353
|
(0, timeout_1.tryCancel)();
|
|
376
354
|
await this._executeHooks(this.postNavigationHooks, crawlingContext, gotOptions);
|
|
377
355
|
(0, timeout_1.tryCancel)();
|
|
378
|
-
if (this.postResponseFunction) {
|
|
379
|
-
this.log.deprecated('Option "postResponseFunction" is deprecated. Use "postNavigationHooks" instead.');
|
|
380
|
-
await this.postResponseFunction(crawlingContext);
|
|
381
|
-
(0, timeout_1.tryCancel)();
|
|
382
|
-
}
|
|
383
356
|
}
|
|
384
357
|
/**
|
|
385
|
-
*
|
|
386
|
-
* as `request.headers` are already merged into the `gotOptions`. This method is using
|
|
387
|
-
* old `request.headers` snapshot (before hooks are executed), makes a diff with the cookie value
|
|
388
|
-
* after hooks are executed, and merges any new cookies back to `gotOptions`.
|
|
389
|
-
*
|
|
390
|
-
* This way we can still use both `gotOptions` and `context.request` in the hooks (not both).
|
|
358
|
+
* Sets the cookie header to `gotOptions` based on the provided request and session headers, as well as any changes that occurred due to hooks.
|
|
391
359
|
*/
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
cookieDiff,
|
|
399
|
-
]);
|
|
400
|
-
}
|
|
360
|
+
_applyCookies({ session, request }, gotOptions, preHookCookies, postHookCookies) {
|
|
361
|
+
const sessionCookie = session?.getCookieString(request.url) ?? '';
|
|
362
|
+
const alteredGotOptionsCookies = (gotOptions.headers?.Cookie ?? gotOptions.headers?.cookie ?? '');
|
|
363
|
+
const mergedCookie = (0, core_1.mergeCookies)(request.url, [sessionCookie, preHookCookies, alteredGotOptionsCookies, postHookCookies]);
|
|
364
|
+
gotOptions.headers ?? (gotOptions.headers = {});
|
|
365
|
+
gotOptions.headers.Cookie = mergedCookie;
|
|
401
366
|
}
|
|
402
367
|
/**
|
|
403
368
|
* Function to make the HTTP request. It performs optimizations
|
|
@@ -417,20 +382,6 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
417
382
|
throw e;
|
|
418
383
|
}
|
|
419
384
|
}
|
|
420
|
-
/**
|
|
421
|
-
* Sets the cookie header to `gotOptions` based on provided session and request. If some cookies were already set,
|
|
422
|
-
* the session cookie will be merged with them. User provided cookies on `request` object have precedence.
|
|
423
|
-
*/
|
|
424
|
-
_applySessionCookie({ request, session }, gotOptions) {
|
|
425
|
-
const userCookie = request.headers?.Cookie ?? request.headers?.cookie;
|
|
426
|
-
const sessionCookie = session.getCookieString(request.url);
|
|
427
|
-
const mergedCookies = (0, core_1.mergeCookies)(request.url, [sessionCookie, userCookie]);
|
|
428
|
-
// merge cookies from all possible sources
|
|
429
|
-
if (mergedCookies) {
|
|
430
|
-
gotOptions.headers ?? (gotOptions.headers = {});
|
|
431
|
-
gotOptions.headers.Cookie = mergedCookies;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
385
|
/**
|
|
435
386
|
* Encodes and parses response according to the provided content type
|
|
436
387
|
*/
|
|
@@ -554,15 +505,6 @@ class CheerioCrawler extends basic_1.BasicCrawler {
|
|
|
554
505
|
}
|
|
555
506
|
});
|
|
556
507
|
}
|
|
557
|
-
/**
|
|
558
|
-
* Handles blocked request
|
|
559
|
-
*/
|
|
560
|
-
_throwOnBlockedRequest(session, statusCode) {
|
|
561
|
-
const isBlocked = session.retireOnBlockedStatusCodes(statusCode);
|
|
562
|
-
if (isBlocked) {
|
|
563
|
-
throw new Error(`Request blocked - received ${statusCode} status code`);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
508
|
/**
|
|
567
509
|
* Handles timeout request
|
|
568
510
|
*/
|
|
@@ -598,23 +540,25 @@ Object.defineProperty(CheerioCrawler, "optionsShape", {
|
|
|
598
540
|
suggestResponseEncoding: ow_1.default.optional.string,
|
|
599
541
|
forceResponseEncoding: ow_1.default.optional.string,
|
|
600
542
|
proxyConfiguration: ow_1.default.optional.object.validate(core_1.validators.proxyConfiguration),
|
|
601
|
-
prepareRequestFunction: ow_1.default.optional.function,
|
|
602
|
-
postResponseFunction: ow_1.default.optional.function,
|
|
603
543
|
persistCookiesPerSession: ow_1.default.optional.boolean,
|
|
604
544
|
preNavigationHooks: ow_1.default.optional.array,
|
|
605
545
|
postNavigationHooks: ow_1.default.optional.array,
|
|
606
546
|
}
|
|
607
547
|
});
|
|
608
548
|
/** @internal */
|
|
609
|
-
async function cheerioCrawlerEnqueueLinks({ options, $, requestQueue,
|
|
549
|
+
async function cheerioCrawlerEnqueueLinks({ options, $, requestQueue, originalRequestUrl, finalRequestUrl }) {
|
|
610
550
|
if (!$) {
|
|
611
551
|
throw new Error('Cannot enqueue links because the DOM is not available.');
|
|
612
552
|
}
|
|
613
|
-
const baseUrl =
|
|
553
|
+
const baseUrl = (0, core_1.resolveBaseUrl)({
|
|
554
|
+
enqueueStrategy: options?.strategy,
|
|
555
|
+
finalRequestUrl,
|
|
556
|
+
originalRequestUrl,
|
|
557
|
+
userProvidedBaseUrl: options?.baseUrl,
|
|
558
|
+
});
|
|
614
559
|
const urls = extractUrlsFromCheerio($, options?.selector ?? 'a', baseUrl);
|
|
615
560
|
return (0, core_1.enqueueLinks)({
|
|
616
|
-
|
|
617
|
-
requestQueue: requestQueue ?? await core_1.RequestQueue.open(),
|
|
561
|
+
requestQueue,
|
|
618
562
|
urls,
|
|
619
563
|
baseUrl,
|
|
620
564
|
...options,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cheerio-crawler.js","sourceRoot":"","sources":["../../src/internals/cheerio-crawler.ts"],"names":[],"mappings":";;;;AAAA,4CAAgE;AAChE,gDAA4E;AAC5E,0CAIwB;AACxB,wCAeuB;AACvB,0CAA2G;AAC3G,8DAAkD;AAClD,wEAA4E;AAC5E,+CAAqG;AACrG,6CAAyC;AACzC,mEAAgE;AAEhE,oEAA+B;AAC/B,oDAAoB;AACpB,wDAAwB;AAExB;;GAEG;AACH,MAAM,uBAAuB,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE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