@crawlee/core 4.0.0-beta.5 → 4.0.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/autoscaling/autoscaled_pool.d.ts +3 -5
- package/autoscaling/autoscaled_pool.d.ts.map +1 -1
- package/autoscaling/autoscaled_pool.js +3 -9
- package/autoscaling/autoscaled_pool.js.map +1 -1
- package/autoscaling/snapshotter.d.ts +3 -13
- package/autoscaling/snapshotter.d.ts.map +1 -1
- package/autoscaling/snapshotter.js +18 -29
- package/autoscaling/snapshotter.js.map +1 -1
- package/autoscaling/system_status.d.ts +0 -3
- package/autoscaling/system_status.d.ts.map +1 -1
- package/autoscaling/system_status.js +2 -3
- package/autoscaling/system_status.js.map +1 -1
- package/configuration.d.ts +85 -227
- package/configuration.d.ts.map +1 -1
- package/configuration.js +159 -223
- package/configuration.js.map +1 -1
- package/cookie_utils.d.ts +1 -1
- package/cookie_utils.d.ts.map +1 -1
- package/cookie_utils.js +8 -8
- package/cookie_utils.js.map +1 -1
- package/crawlers/context_pipeline.d.ts +71 -0
- package/crawlers/context_pipeline.d.ts.map +1 -0
- package/crawlers/context_pipeline.js +123 -0
- package/crawlers/context_pipeline.js.map +1 -0
- package/crawlers/crawler_commons.d.ts +19 -27
- package/crawlers/crawler_commons.d.ts.map +1 -1
- package/crawlers/crawler_commons.js +12 -20
- package/crawlers/crawler_commons.js.map +1 -1
- package/crawlers/crawler_utils.js +1 -1
- package/crawlers/crawler_utils.js.map +1 -1
- package/crawlers/error_snapshotter.d.ts +3 -2
- package/crawlers/error_snapshotter.d.ts.map +1 -1
- package/crawlers/error_snapshotter.js +2 -2
- package/crawlers/error_snapshotter.js.map +1 -1
- package/crawlers/error_tracker.d.ts +2 -1
- package/crawlers/error_tracker.d.ts.map +1 -1
- package/crawlers/error_tracker.js.map +1 -1
- package/crawlers/index.d.ts +1 -1
- package/crawlers/index.d.ts.map +1 -1
- package/crawlers/index.js +1 -1
- package/crawlers/index.js.map +1 -1
- package/crawlers/internals/types.d.ts +8 -0
- package/crawlers/internals/types.d.ts.map +1 -0
- package/crawlers/internals/types.js +2 -0
- package/crawlers/internals/types.js.map +1 -0
- package/crawlers/statistics.d.ts +15 -15
- package/crawlers/statistics.d.ts.map +1 -1
- package/crawlers/statistics.js +21 -18
- package/crawlers/statistics.js.map +1 -1
- package/enqueue_links/enqueue_links.d.ts +32 -18
- package/enqueue_links/enqueue_links.d.ts.map +1 -1
- package/enqueue_links/enqueue_links.js +45 -24
- package/enqueue_links/enqueue_links.js.map +1 -1
- package/enqueue_links/shared.d.ts +25 -8
- package/enqueue_links/shared.d.ts.map +1 -1
- package/enqueue_links/shared.js +69 -37
- package/enqueue_links/shared.js.map +1 -1
- package/errors.d.ts +30 -0
- package/errors.d.ts.map +1 -1
- package/errors.js +44 -0
- package/errors.js.map +1 -1
- package/events/event_manager.d.ts +8 -5
- package/events/event_manager.d.ts.map +1 -1
- package/events/event_manager.js +7 -9
- package/events/event_manager.js.map +1 -1
- package/events/local_event_manager.d.ts +14 -4
- package/events/local_event_manager.d.ts.map +1 -1
- package/events/local_event_manager.js +33 -39
- package/events/local_event_manager.js.map +1 -1
- package/index.d.ts +3 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/log.d.ts +82 -2
- package/log.d.ts.map +1 -1
- package/log.js +102 -0
- package/log.js.map +1 -1
- package/package.json +9 -10
- package/proxy_configuration.d.ts +14 -148
- package/proxy_configuration.d.ts.map +1 -1
- package/proxy_configuration.js +19 -167
- package/proxy_configuration.js.map +1 -1
- package/recoverable_state.d.ts +121 -0
- package/recoverable_state.d.ts.map +1 -0
- package/recoverable_state.js +142 -0
- package/recoverable_state.js.map +1 -0
- package/request.d.ts +74 -8
- package/request.d.ts.map +1 -1
- package/request.js +87 -18
- package/request.js.map +1 -1
- package/router.d.ts.map +1 -1
- package/router.js.map +1 -1
- package/serialization.js +1 -1
- package/serialization.js.map +1 -1
- package/service_locator.d.ts +162 -0
- package/service_locator.d.ts.map +1 -0
- package/service_locator.js +247 -0
- package/service_locator.js.map +1 -0
- package/session_pool/session.d.ts +9 -31
- package/session_pool/session.d.ts.map +1 -1
- package/session_pool/session.js +17 -21
- package/session_pool/session.js.map +1 -1
- package/session_pool/session_pool.d.ts +51 -57
- package/session_pool/session_pool.d.ts.map +1 -1
- package/session_pool/session_pool.js +86 -79
- package/session_pool/session_pool.js.map +1 -1
- package/storages/dataset.d.ts +63 -19
- package/storages/dataset.d.ts.map +1 -1
- package/storages/dataset.js +86 -22
- package/storages/dataset.js.map +1 -1
- package/storages/index.d.ts +2 -0
- package/storages/index.d.ts.map +1 -1
- package/storages/index.js +2 -0
- package/storages/index.js.map +1 -1
- package/storages/key_value_store.d.ts +79 -10
- package/storages/key_value_store.d.ts.map +1 -1
- package/storages/key_value_store.js +104 -23
- package/storages/key_value_store.js.map +1 -1
- package/storages/request_list.d.ts +9 -9
- package/storages/request_list.d.ts.map +1 -1
- package/storages/request_list.js +13 -8
- package/storages/request_list.js.map +1 -1
- package/storages/request_list_adapter.d.ts +58 -0
- package/storages/request_list_adapter.d.ts.map +1 -0
- package/storages/request_list_adapter.js +81 -0
- package/storages/request_list_adapter.js.map +1 -0
- package/storages/request_manager_tandem.d.ts +68 -0
- package/storages/request_manager_tandem.d.ts.map +1 -0
- package/storages/request_manager_tandem.js +124 -0
- package/storages/request_manager_tandem.js.map +1 -0
- package/storages/request_provider.d.ts +86 -23
- package/storages/request_provider.d.ts.map +1 -1
- package/storages/request_provider.js +114 -74
- package/storages/request_provider.js.map +1 -1
- package/storages/request_queue.d.ts +1 -3
- package/storages/request_queue.d.ts.map +1 -1
- package/storages/request_queue.js +2 -4
- package/storages/request_queue.js.map +1 -1
- package/storages/request_queue_v2.d.ts +3 -3
- package/storages/request_queue_v2.d.ts.map +1 -1
- package/storages/request_queue_v2.js +4 -5
- package/storages/request_queue_v2.js.map +1 -1
- package/storages/sitemap_request_list.d.ts +5 -5
- package/storages/sitemap_request_list.d.ts.map +1 -1
- package/storages/sitemap_request_list.js +10 -7
- package/storages/sitemap_request_list.js.map +1 -1
- package/storages/storage_manager.d.ts +22 -17
- package/storages/storage_manager.d.ts.map +1 -1
- package/storages/storage_manager.js +58 -52
- package/storages/storage_manager.js.map +1 -1
- package/storages/utils.d.ts.map +1 -1
- package/storages/utils.js +6 -5
- package/storages/utils.js.map +1 -1
- package/typedefs.d.ts +1 -1
- package/typedefs.d.ts.map +1 -1
- package/crawlers/crawler_extension.d.ts +0 -12
- package/crawlers/crawler_extension.d.ts.map +0 -1
- package/crawlers/crawler_extension.js +0 -14
- package/crawlers/crawler_extension.js.map +0 -1
- package/http_clients/base-http-client.d.ts +0 -134
- package/http_clients/base-http-client.d.ts.map +0 -1
- package/http_clients/base-http-client.js +0 -33
- package/http_clients/base-http-client.js.map +0 -1
- package/http_clients/form-data-like.d.ts +0 -67
- package/http_clients/form-data-like.d.ts.map +0 -1
- package/http_clients/form-data-like.js +0 -5
- package/http_clients/form-data-like.js.map +0 -1
- package/http_clients/got-scraping-http-client.d.ts +0 -15
- package/http_clients/got-scraping-http-client.d.ts.map +0 -1
- package/http_clients/got-scraping-http-client.js +0 -69
- package/http_clients/got-scraping-http-client.js.map +0 -1
- package/http_clients/index.d.ts +0 -3
- package/http_clients/index.d.ts.map +0 -1
- package/http_clients/index.js +0 -3
- package/http_clients/index.js.map +0 -1
- package/tsconfig.build.tsbuildinfo +0 -1
package/request.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BinaryLike } from 'node:crypto';
|
|
2
2
|
import type { Dictionary } from '@crawlee/types';
|
|
3
3
|
import type { EnqueueLinksOptions } from './enqueue_links/enqueue_links.js';
|
|
4
|
+
import type { SkippedRequestReason } from './enqueue_links/shared.js';
|
|
4
5
|
import type { AllowedHttpMethods } from './typedefs.js';
|
|
5
6
|
export declare enum RequestState {
|
|
6
7
|
UNPROCESSED = 0,
|
|
@@ -43,7 +44,7 @@ export declare enum RequestState {
|
|
|
43
44
|
* ```
|
|
44
45
|
* @category Sources
|
|
45
46
|
*/
|
|
46
|
-
|
|
47
|
+
declare class CrawleeRequest<UserData extends Dictionary = Dictionary> {
|
|
47
48
|
/** Request ID */
|
|
48
49
|
id?: string;
|
|
49
50
|
/** URL of the web page to crawl. */
|
|
@@ -76,7 +77,12 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
76
77
|
headers?: Record<string, string>;
|
|
77
78
|
/** Private store for the custom user data assigned to the request. */
|
|
78
79
|
private _userData;
|
|
79
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Custom user data assigned to the request.
|
|
82
|
+
*
|
|
83
|
+
* All data stored in `userData` must be JSON-serializable.
|
|
84
|
+
* Storing non-serializable values (e.g. functions, symbols) may result in unexpected results.
|
|
85
|
+
*/
|
|
80
86
|
userData: UserData;
|
|
81
87
|
/**
|
|
82
88
|
* ISO datetime string that indicates the time when the request has been processed.
|
|
@@ -87,14 +93,44 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
87
93
|
* `Request` parameters including the URL, HTTP method and headers, and others.
|
|
88
94
|
*/
|
|
89
95
|
constructor(options: RequestOptions<UserData>);
|
|
90
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Converts the Crawlee Request object to a `fetch` API Request object.
|
|
98
|
+
* @returns The native `fetch` API Request object.
|
|
99
|
+
*/
|
|
100
|
+
intoFetchAPIRequest(): Request;
|
|
101
|
+
/**
|
|
102
|
+
* Tells the crawler processing this request to skip the navigation and process the request directly.
|
|
103
|
+
*
|
|
104
|
+
* When this is set to `true`, the crawling context will not contain the results of the navigation
|
|
105
|
+
* (e.g. `response`, `body`, `contentType`, `$` or `request.loadedUrl`).
|
|
106
|
+
* Accessing these properties will throw a {@link NavigationSkippedError} at runtime.
|
|
107
|
+
*/
|
|
91
108
|
get skipNavigation(): boolean;
|
|
92
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Tells the crawler processing this request to skip the navigation and process the request directly.
|
|
111
|
+
*
|
|
112
|
+
* When this is set to `true`, the crawling context will not contain the results of the navigation
|
|
113
|
+
* (e.g. `response`, `body`, `contentType`, `$` or `request.loadedUrl`).
|
|
114
|
+
* Accessing these properties will throw a {@link NavigationSkippedError} at runtime.
|
|
115
|
+
*/
|
|
93
116
|
set skipNavigation(value: boolean);
|
|
117
|
+
/**
|
|
118
|
+
* Depth of the request in the current crawl tree.
|
|
119
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
120
|
+
*/
|
|
121
|
+
get crawlDepth(): number;
|
|
122
|
+
/**
|
|
123
|
+
* Depth of the request in the current crawl tree.
|
|
124
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
125
|
+
*/
|
|
126
|
+
set crawlDepth(value: number);
|
|
94
127
|
/** Indicates the number of times the crawling of the request has rotated the session due to a session or a proxy error. */
|
|
95
128
|
get sessionRotationCount(): number;
|
|
96
129
|
/** Indicates the number of times the crawling of the request has rotated the session due to a session or a proxy error. */
|
|
97
130
|
set sessionRotationCount(value: number);
|
|
131
|
+
/** ID of a session to use for this request. When set, the crawler will fetch this session from the session pool instead of creating a new one. */
|
|
132
|
+
get sessionId(): string | undefined;
|
|
133
|
+
set sessionId(value: string | undefined);
|
|
98
134
|
/** shortcut for getting `request.userData.label` */
|
|
99
135
|
get label(): string | undefined;
|
|
100
136
|
/** shortcut for setting `request.userData.label` */
|
|
@@ -107,6 +143,14 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
107
143
|
get state(): RequestState;
|
|
108
144
|
/** Describes the request's current lifecycle state. */
|
|
109
145
|
set state(value: RequestState);
|
|
146
|
+
/**
|
|
147
|
+
* Reason for skipping this request.
|
|
148
|
+
*/
|
|
149
|
+
get skippedReason(): SkippedRequestReason | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Reason for skipping this request.
|
|
152
|
+
*/
|
|
153
|
+
set skippedReason(value: SkippedRequestReason | undefined);
|
|
110
154
|
private get enqueueStrategy();
|
|
111
155
|
private set enqueueStrategy(value);
|
|
112
156
|
/**
|
|
@@ -123,8 +167,6 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
123
167
|
* @param [options]
|
|
124
168
|
*/
|
|
125
169
|
pushErrorMessage(errorOrMessage: unknown, options?: PushErrorMessageOptions): void;
|
|
126
|
-
protected _computeUniqueKey(options: ComputeUniqueKeyOptions): string;
|
|
127
|
-
protected _hashPayload(payload: BinaryLike): string;
|
|
128
170
|
/** @internal */
|
|
129
171
|
static computeUniqueKey({ url, method, payload, keepUrlFragment, useExtendedUniqueKey, }: ComputeUniqueKeyOptions): string;
|
|
130
172
|
/** @internal */
|
|
@@ -171,6 +213,9 @@ export interface RequestOptions<UserData extends Dictionary = Dictionary> {
|
|
|
171
213
|
/**
|
|
172
214
|
* Custom user data assigned to the request. Use this to save any request related data to the
|
|
173
215
|
* request's scope, keeping them accessible on retries, failures etc.
|
|
216
|
+
*
|
|
217
|
+
* All data stored in `userData` must be JSON-serializable.
|
|
218
|
+
* Storing non-serializable values (e.g. functions, symbols) may result in unexpected results.
|
|
174
219
|
*/
|
|
175
220
|
userData?: UserData;
|
|
176
221
|
/**
|
|
@@ -197,12 +242,33 @@ export interface RequestOptions<UserData extends Dictionary = Dictionary> {
|
|
|
197
242
|
* @default false
|
|
198
243
|
*/
|
|
199
244
|
noRetry?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* ID of a session from the crawler's `SessionPool` to use for this request.
|
|
247
|
+
* When set, the crawler will fetch this session from the pool instead of creating a new one.
|
|
248
|
+
*/
|
|
249
|
+
sessionId?: string;
|
|
200
250
|
/**
|
|
201
251
|
* If set to `true` then the crawler processing this request evaluates
|
|
202
252
|
* the `requestHandler` immediately without prior browser navigation.
|
|
253
|
+
*
|
|
254
|
+
* When enabled, the crawling context will not contain the results of the navigation
|
|
255
|
+
* (e.g. `response`, `body`, `contentType`, `$` or `request.loadedUrl`).
|
|
256
|
+
* Accessing these properties will throw a {@link NavigationSkippedError} at runtime.
|
|
203
257
|
* @default false
|
|
204
258
|
*/
|
|
205
259
|
skipNavigation?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Depth of the request in the current crawl tree.
|
|
262
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
263
|
+
* @default 0
|
|
264
|
+
*/
|
|
265
|
+
crawlDepth?: number;
|
|
266
|
+
/**
|
|
267
|
+
* Reason for skipping this request.
|
|
268
|
+
* This is used to provide more information about why the request was skipped.
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
skippedReason?: SkippedRequestReason;
|
|
206
272
|
/**
|
|
207
273
|
* Maximum number of retries for this request. Allows to override the global `maxRequestRetries` option of `BasicCrawler`.
|
|
208
274
|
*/
|
|
@@ -233,11 +299,11 @@ interface ComputeUniqueKeyOptions {
|
|
|
233
299
|
export type Source = (Partial<RequestOptions> & {
|
|
234
300
|
requestsFromUrl?: string;
|
|
235
301
|
regex?: RegExp;
|
|
236
|
-
}) |
|
|
302
|
+
}) | CrawleeRequest;
|
|
237
303
|
/** @internal */
|
|
238
304
|
export interface InternalSource {
|
|
239
305
|
requestsFromUrl: string;
|
|
240
306
|
regex?: RegExp;
|
|
241
307
|
}
|
|
242
|
-
export {};
|
|
308
|
+
export { CrawleeRequest as Request };
|
|
243
309
|
//# sourceMappingURL=request.d.ts.map
|
package/request.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../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MAAM,CAAC;IAEZ,gBAAgB;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gBAAgB;IAChB,aAAa,CAAC,EAAE,IAAI,CAAC;IAErB,gBAAgB;IAChB,eAAe,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,uBAAuB;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,uBAAuB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG;IAAE,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,cAAc,CAAC;AAE/G,gBAAgB;AAChB,MAAM,WAAW,cAAc;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,OAAO,EAAE,cAAc,IAAI,OAAO,EAAE,CAAC"}
|
package/request.js
CHANGED
|
@@ -2,10 +2,9 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import util from 'node:util';
|
|
3
3
|
import ow from 'ow';
|
|
4
4
|
import { normalizeUrl } from '@apify/utilities';
|
|
5
|
-
import {
|
|
5
|
+
import { serviceLocator } from './service_locator.js';
|
|
6
6
|
import { keys } from './typedefs.js';
|
|
7
7
|
// new properties on the Request object breaks serialization
|
|
8
|
-
const log = defaultLog.child({ prefix: 'Request' });
|
|
9
8
|
const requestOptionalPredicates = {
|
|
10
9
|
id: ow.optional.string,
|
|
11
10
|
loadedUrl: ow.optional.string.url,
|
|
@@ -15,6 +14,7 @@ const requestOptionalPredicates = {
|
|
|
15
14
|
noRetry: ow.optional.boolean,
|
|
16
15
|
retryCount: ow.optional.number,
|
|
17
16
|
sessionRotationCount: ow.optional.number,
|
|
17
|
+
sessionId: ow.optional.string,
|
|
18
18
|
maxRetries: ow.optional.number,
|
|
19
19
|
errorMessages: ow.optional.array.ofType(ow.string),
|
|
20
20
|
headers: ow.optional.object,
|
|
@@ -24,6 +24,7 @@ const requestOptionalPredicates = {
|
|
|
24
24
|
keepUrlFragment: ow.optional.boolean,
|
|
25
25
|
useExtendedUniqueKey: ow.optional.boolean,
|
|
26
26
|
skipNavigation: ow.optional.boolean,
|
|
27
|
+
crawlDepth: ow.optional.number.greaterThanOrEqual(0),
|
|
27
28
|
state: ow.optional.number.greaterThanOrEqual(0).lessThanOrEqual(6),
|
|
28
29
|
};
|
|
29
30
|
export var RequestState;
|
|
@@ -68,7 +69,7 @@ export var RequestState;
|
|
|
68
69
|
* ```
|
|
69
70
|
* @category Sources
|
|
70
71
|
*/
|
|
71
|
-
|
|
72
|
+
class CrawleeRequest {
|
|
72
73
|
/** Request ID */
|
|
73
74
|
id;
|
|
74
75
|
/** URL of the web page to crawl. */
|
|
@@ -101,7 +102,12 @@ export class Request {
|
|
|
101
102
|
headers;
|
|
102
103
|
/** Private store for the custom user data assigned to the request. */
|
|
103
104
|
_userData = {};
|
|
104
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Custom user data assigned to the request.
|
|
107
|
+
*
|
|
108
|
+
* All data stored in `userData` must be JSON-serializable.
|
|
109
|
+
* Storing non-serializable values (e.g. functions, symbols) may result in unexpected results.
|
|
110
|
+
*/
|
|
105
111
|
userData = {};
|
|
106
112
|
/**
|
|
107
113
|
* ISO datetime string that indicates the time when the request has been processed.
|
|
@@ -130,7 +136,7 @@ export class Request {
|
|
|
130
136
|
ow(value, `RequestOptions.${prop}`, predicate);
|
|
131
137
|
}
|
|
132
138
|
});
|
|
133
|
-
const { id, url, loadedUrl, uniqueKey, payload, noRetry = false, retryCount = 0, sessionRotationCount = 0, maxRetries, errorMessages = [], headers = {}, userData = {}, label, handledAt, keepUrlFragment = false, useExtendedUniqueKey = false, skipNavigation, enqueueStrategy, } = options;
|
|
139
|
+
const { id, url, loadedUrl, uniqueKey, payload, noRetry = false, retryCount = 0, sessionRotationCount = 0, sessionId, maxRetries, errorMessages = [], headers = {}, userData = {}, label, handledAt, keepUrlFragment = false, useExtendedUniqueKey = false, skipNavigation, enqueueStrategy, crawlDepth, } = options;
|
|
134
140
|
let { method = 'GET' } = options;
|
|
135
141
|
method = method.toUpperCase();
|
|
136
142
|
if (method === 'GET' && payload)
|
|
@@ -139,7 +145,8 @@ export class Request {
|
|
|
139
145
|
this.url = url;
|
|
140
146
|
this.loadedUrl = loadedUrl;
|
|
141
147
|
this.uniqueKey =
|
|
142
|
-
uniqueKey ||
|
|
148
|
+
uniqueKey ||
|
|
149
|
+
CrawleeRequest.computeUniqueKey({ url, method, payload, keepUrlFragment, useExtendedUniqueKey });
|
|
143
150
|
this.method = method;
|
|
144
151
|
this.payload = payload;
|
|
145
152
|
this.noRetry = noRetry;
|
|
@@ -191,16 +198,43 @@ export class Request {
|
|
|
191
198
|
this.skipNavigation = skipNavigation;
|
|
192
199
|
if (maxRetries != null)
|
|
193
200
|
this.maxRetries = maxRetries;
|
|
201
|
+
if (crawlDepth != null)
|
|
202
|
+
this.userData.__crawlee.crawlDepth ??= crawlDepth;
|
|
203
|
+
if (sessionId)
|
|
204
|
+
this.sessionId = sessionId;
|
|
194
205
|
// If it's already set, don't override it (for instance when fetching from storage)
|
|
195
206
|
if (enqueueStrategy) {
|
|
196
207
|
this.enqueueStrategy ??= enqueueStrategy;
|
|
197
208
|
}
|
|
198
209
|
}
|
|
199
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* Converts the Crawlee Request object to a `fetch` API Request object.
|
|
212
|
+
* @returns The native `fetch` API Request object.
|
|
213
|
+
*/
|
|
214
|
+
intoFetchAPIRequest() {
|
|
215
|
+
return new Request(this.url, {
|
|
216
|
+
method: this.method,
|
|
217
|
+
headers: this.headers,
|
|
218
|
+
body: this.payload,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Tells the crawler processing this request to skip the navigation and process the request directly.
|
|
223
|
+
*
|
|
224
|
+
* When this is set to `true`, the crawling context will not contain the results of the navigation
|
|
225
|
+
* (e.g. `response`, `body`, `contentType`, `$` or `request.loadedUrl`).
|
|
226
|
+
* Accessing these properties will throw a {@link NavigationSkippedError} at runtime.
|
|
227
|
+
*/
|
|
200
228
|
get skipNavigation() {
|
|
201
229
|
return this.userData.__crawlee?.skipNavigation ?? false;
|
|
202
230
|
}
|
|
203
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* Tells the crawler processing this request to skip the navigation and process the request directly.
|
|
233
|
+
*
|
|
234
|
+
* When this is set to `true`, the crawling context will not contain the results of the navigation
|
|
235
|
+
* (e.g. `response`, `body`, `contentType`, `$` or `request.loadedUrl`).
|
|
236
|
+
* Accessing these properties will throw a {@link NavigationSkippedError} at runtime.
|
|
237
|
+
*/
|
|
204
238
|
set skipNavigation(value) {
|
|
205
239
|
if (!this.userData.__crawlee) {
|
|
206
240
|
this.userData.__crawlee = { skipNavigation: value };
|
|
@@ -209,6 +243,21 @@ export class Request {
|
|
|
209
243
|
this.userData.__crawlee.skipNavigation = value;
|
|
210
244
|
}
|
|
211
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Depth of the request in the current crawl tree.
|
|
248
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
249
|
+
*/
|
|
250
|
+
get crawlDepth() {
|
|
251
|
+
return this.userData.__crawlee?.crawlDepth ?? 0;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Depth of the request in the current crawl tree.
|
|
255
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
256
|
+
*/
|
|
257
|
+
set crawlDepth(value) {
|
|
258
|
+
this.userData.__crawlee ??= {};
|
|
259
|
+
this.userData.__crawlee.crawlDepth = value;
|
|
260
|
+
}
|
|
212
261
|
/** Indicates the number of times the crawling of the request has rotated the session due to a session or a proxy error. */
|
|
213
262
|
get sessionRotationCount() {
|
|
214
263
|
return this.userData.__crawlee?.sessionRotationCount ?? 0;
|
|
@@ -222,6 +271,14 @@ export class Request {
|
|
|
222
271
|
this.userData.__crawlee.sessionRotationCount = value;
|
|
223
272
|
}
|
|
224
273
|
}
|
|
274
|
+
/** ID of a session to use for this request. When set, the crawler will fetch this session from the session pool instead of creating a new one. */
|
|
275
|
+
get sessionId() {
|
|
276
|
+
return this.userData.__crawlee?.sessionId;
|
|
277
|
+
}
|
|
278
|
+
set sessionId(value) {
|
|
279
|
+
this.userData.__crawlee ??= {};
|
|
280
|
+
this.userData.__crawlee.sessionId = value;
|
|
281
|
+
}
|
|
225
282
|
/** shortcut for getting `request.userData.label` */
|
|
226
283
|
get label() {
|
|
227
284
|
return this.userData.label;
|
|
@@ -256,6 +313,23 @@ export class Request {
|
|
|
256
313
|
this.userData.__crawlee.state = value;
|
|
257
314
|
}
|
|
258
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Reason for skipping this request.
|
|
318
|
+
*/
|
|
319
|
+
get skippedReason() {
|
|
320
|
+
return this.userData.__crawlee?.skippedReason;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Reason for skipping this request.
|
|
324
|
+
*/
|
|
325
|
+
set skippedReason(value) {
|
|
326
|
+
if (!this.userData.__crawlee) {
|
|
327
|
+
this.userData.__crawlee = { skippedReason: value };
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.userData.__crawlee.skippedReason = value;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
259
333
|
get enqueueStrategy() {
|
|
260
334
|
return this.userData.__crawlee?.enqueueStrategy;
|
|
261
335
|
}
|
|
@@ -317,27 +391,21 @@ export class Request {
|
|
|
317
391
|
}
|
|
318
392
|
this.errorMessages.push(message);
|
|
319
393
|
}
|
|
320
|
-
// TODO: only for better BC, remove in v4
|
|
321
|
-
_computeUniqueKey(options) {
|
|
322
|
-
return Request.computeUniqueKey(options);
|
|
323
|
-
}
|
|
324
|
-
// TODO: only for better BC, remove in v4
|
|
325
|
-
_hashPayload(payload) {
|
|
326
|
-
return Request.hashPayload(payload);
|
|
327
|
-
}
|
|
328
394
|
/** @internal */
|
|
329
395
|
static computeUniqueKey({ url, method = 'GET', payload, keepUrlFragment = false, useExtendedUniqueKey = false, }) {
|
|
330
396
|
const normalizedMethod = method.toUpperCase();
|
|
331
397
|
const normalizedUrl = normalizeUrl(url, keepUrlFragment) || url; // It returns null when url is invalid, causing weird errors.
|
|
332
398
|
if (!useExtendedUniqueKey) {
|
|
333
399
|
if (normalizedMethod !== 'GET' && payload) {
|
|
334
|
-
|
|
400
|
+
serviceLocator
|
|
401
|
+
.getLogger()
|
|
402
|
+
.warningOnce(`We've encountered a ${normalizedMethod} Request with a payload. ` +
|
|
335
403
|
'This is fine. Just letting you know that if your requests point to the same URL ' +
|
|
336
404
|
'and differ only in method and payload, you should see the "useExtendedUniqueKey" option of Request constructor.');
|
|
337
405
|
}
|
|
338
406
|
return normalizedUrl;
|
|
339
407
|
}
|
|
340
|
-
const payloadHash = payload ?
|
|
408
|
+
const payloadHash = payload ? CrawleeRequest.hashPayload(payload) : '';
|
|
341
409
|
return `${normalizedMethod}(${payloadHash}):${normalizedUrl}`;
|
|
342
410
|
}
|
|
343
411
|
/** @internal */
|
|
@@ -345,4 +413,5 @@ export class Request {
|
|
|
345
413
|
return crypto.createHash('sha256').update(payload).digest('base64').replace(/[+/=]/g, '').substring(0, 8);
|
|
346
414
|
}
|
|
347
415
|
}
|
|
416
|
+
export { CrawleeRequest as Request };
|
|
348
417
|
//# sourceMappingURL=request.js.map
|
package/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":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tC,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,WAAW,OAAgB;YACzC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,IAAI,GAAG,EAAE,CAAC,CAAC;YAEpE,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBAC1C,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;YAED,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAEjC,OAAO,IAAyC,CAAC;IACrD,CAAC;CACJ"}
|
package/serialization.js
CHANGED
|
@@ -116,7 +116,7 @@ function createChunkCollector(options = {}) {
|
|
|
116
116
|
}
|
|
117
117
|
function pluckValue(streamArray) {
|
|
118
118
|
const realPush = streamArray.push.bind(streamArray);
|
|
119
|
-
streamArray.push = (obj) => realPush(obj
|
|
119
|
+
streamArray.push = (obj) => realPush(obj?.value ?? null);
|
|
120
120
|
return streamArray;
|
|
121
121
|
}
|
|
122
122
|
//# sourceMappingURL=serialization.js.map
|
package/serialization.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,Q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AC;YACH,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;YAC9B,QAAQ,EAAE,CAAC;QACf,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,UAAU,CAAC,WAAkB;IAClC,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,WAAW,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC;IACzD,OAAO,WAAW,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { StorageClient } from '@crawlee/types';
|
|
2
|
+
import { Configuration } from './configuration.js';
|
|
3
|
+
import type { EventManager } from './events/event_manager.js';
|
|
4
|
+
import type { CrawleeLogger } from './log.js';
|
|
5
|
+
import type { IStorage, StorageManager } from './storages/storage_manager.js';
|
|
6
|
+
import type { Constructor } from './typedefs.js';
|
|
7
|
+
interface ServiceLocatorInterface {
|
|
8
|
+
/**
|
|
9
|
+
* Get the configuration.
|
|
10
|
+
* Creates a default Configuration instance if none has been set.
|
|
11
|
+
*/
|
|
12
|
+
getConfiguration(): Configuration;
|
|
13
|
+
/**
|
|
14
|
+
* Set the configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param configuration The configuration to set
|
|
17
|
+
* @throws {ServiceConflictError} If a different configuration has already been retrieved
|
|
18
|
+
*/
|
|
19
|
+
setConfiguration(configuration: Configuration): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get the event manager.
|
|
22
|
+
* Creates a default LocalEventManager instance if none has been set.
|
|
23
|
+
*/
|
|
24
|
+
getEventManager(): EventManager;
|
|
25
|
+
/**
|
|
26
|
+
* Set the event manager.
|
|
27
|
+
*
|
|
28
|
+
* @param eventManager The event manager to set
|
|
29
|
+
* @throws {ServiceConflictError} If a different event manager has already been retrieved
|
|
30
|
+
*/
|
|
31
|
+
setEventManager(eventManager: EventManager): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get the storage client.
|
|
34
|
+
* Creates a default MemoryStorage instance if none has been set.
|
|
35
|
+
*/
|
|
36
|
+
getStorageClient(): StorageClient;
|
|
37
|
+
/**
|
|
38
|
+
* Set the storage client.
|
|
39
|
+
*
|
|
40
|
+
* @param storageClient The storage client to set
|
|
41
|
+
* @throws {ServiceConflictError} If a different storage client has already been retrieved
|
|
42
|
+
*/
|
|
43
|
+
setStorageClient(storageClient: StorageClient): void;
|
|
44
|
+
/**
|
|
45
|
+
* Get the logger.
|
|
46
|
+
* Returns the default `@apify/log` logger if none has been set.
|
|
47
|
+
*/
|
|
48
|
+
getLogger(): CrawleeLogger;
|
|
49
|
+
/**
|
|
50
|
+
* Set the logger.
|
|
51
|
+
*
|
|
52
|
+
* @param logger The logger to set
|
|
53
|
+
* @throws {ServiceConflictError} If a different logger has already been retrieved
|
|
54
|
+
*/
|
|
55
|
+
setLogger(logger: CrawleeLogger): void;
|
|
56
|
+
/**
|
|
57
|
+
* Get a child logger with the given prefix.
|
|
58
|
+
* Equivalent to `getLogger().child({ prefix })`.
|
|
59
|
+
*/
|
|
60
|
+
getChildLog(prefix: string): CrawleeLogger;
|
|
61
|
+
getStorageManager(constructor: Constructor<IStorage>): StorageManager | undefined;
|
|
62
|
+
setStorageManager(constructor: Constructor<IStorage>, storageManager: StorageManager): void;
|
|
63
|
+
/**
|
|
64
|
+
* Clears all storage manager caches.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
clearStorageManagerCache(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Resets the service locator to its initial state.
|
|
70
|
+
* Used mainly for testing purposes.
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
reset(): void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Service locator for managing the services used by Crawlee.
|
|
77
|
+
*
|
|
78
|
+
* All services are initialized to their default value lazily.
|
|
79
|
+
*
|
|
80
|
+
* There are two primary usage patterns:
|
|
81
|
+
*
|
|
82
|
+
* **1. Global service locator (for default services):**
|
|
83
|
+
* ```typescript
|
|
84
|
+
* import { serviceLocator, BasicCrawler } from 'crawlee';
|
|
85
|
+
*
|
|
86
|
+
* // Optionally configure global services before creating crawlers
|
|
87
|
+
* serviceLocator.setStorageClient(myCustomClient);
|
|
88
|
+
*
|
|
89
|
+
* // Crawler uses global services
|
|
90
|
+
* const crawler = new BasicCrawler({ ... });
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* **2. Per-crawler services (recommended for isolation):**
|
|
94
|
+
* ```typescript
|
|
95
|
+
* import { BasicCrawler, Configuration, LocalEventManager } from 'crawlee';
|
|
96
|
+
* import { MemoryStorage } from '@crawlee/memory-storage';
|
|
97
|
+
*
|
|
98
|
+
* const crawler = new BasicCrawler({
|
|
99
|
+
* requestHandler: async ({ request }) => { ... },
|
|
100
|
+
* configuration: new Configuration({ ... }), // custom config
|
|
101
|
+
* storageClient: new MemoryStorage(), // custom storage
|
|
102
|
+
* eventManager: LocalEventManager.fromConfig(), // custom events
|
|
103
|
+
* });
|
|
104
|
+
* // Crawler has its own isolated ServiceLocator instance
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare class ServiceLocator implements ServiceLocatorInterface {
|
|
108
|
+
private configuration?;
|
|
109
|
+
private eventManager?;
|
|
110
|
+
private storageClient?;
|
|
111
|
+
private logger?;
|
|
112
|
+
/**
|
|
113
|
+
* Storage managers for Dataset, KeyValueStore, and RequestQueue.
|
|
114
|
+
* Manages caching and lifecycle of storage instances.
|
|
115
|
+
*/
|
|
116
|
+
private storageManagers;
|
|
117
|
+
/**
|
|
118
|
+
* Creates a new ServiceLocator instance.
|
|
119
|
+
*
|
|
120
|
+
* @param configuration Optional configuration instance to use
|
|
121
|
+
* @param eventManager Optional event manager instance to use
|
|
122
|
+
* @param storageClient Optional storage client instance to use
|
|
123
|
+
* @param logger Optional logger instance to use
|
|
124
|
+
*/
|
|
125
|
+
constructor(configuration?: Configuration, eventManager?: EventManager, storageClient?: StorageClient, logger?: CrawleeLogger);
|
|
126
|
+
getConfiguration(): Configuration;
|
|
127
|
+
setConfiguration(configuration: Configuration): void;
|
|
128
|
+
getEventManager(): EventManager;
|
|
129
|
+
setEventManager(eventManager: EventManager): void;
|
|
130
|
+
getStorageClient(): StorageClient;
|
|
131
|
+
setStorageClient(storageClient: StorageClient): void;
|
|
132
|
+
getLogger(): CrawleeLogger;
|
|
133
|
+
setLogger(logger: CrawleeLogger): void;
|
|
134
|
+
getChildLog(prefix: string): CrawleeLogger;
|
|
135
|
+
getStorageManager(constructor: Constructor<IStorage>): StorageManager | undefined;
|
|
136
|
+
setStorageManager(constructor: Constructor<IStorage>, storageManager: StorageManager): void;
|
|
137
|
+
clearStorageManagerCache(): void;
|
|
138
|
+
reset(): void;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Wraps all methods on `target` so that any code they invoke will see the given
|
|
142
|
+
* `serviceLocator` via `AsyncLocalStorage`, rather than the global one.
|
|
143
|
+
*
|
|
144
|
+
* Walks the prototype chain and replaces each method on the *instance* (not the prototype)
|
|
145
|
+
* with a wrapper that calls `serviceLocatorStorage.run(serviceLocator, originalMethod)`.
|
|
146
|
+
*
|
|
147
|
+
* The `AsyncLocalStorage` context propagates through the entire sync/async call tree of each
|
|
148
|
+
* wrapped method — including `super` calls, since the prototype methods execute within the
|
|
149
|
+
* context established by the instance-level wrapper.
|
|
150
|
+
*
|
|
151
|
+
* @internal
|
|
152
|
+
* @returns Scope control functions: `run` executes a callback within the scoped context,
|
|
153
|
+
* `enterScope`/`exitScope` allow entering/leaving the scope imperatively (e.g., for constructor bodies).
|
|
154
|
+
*/
|
|
155
|
+
export declare function bindMethodsToServiceLocator(serviceLocator: ServiceLocator, target: {}): {
|
|
156
|
+
run: <T>(fn: () => T) => T;
|
|
157
|
+
enterScope: () => void;
|
|
158
|
+
exitScope: () => void;
|
|
159
|
+
};
|
|
160
|
+
export declare const serviceLocator: ServiceLocatorInterface;
|
|
161
|
+
export {};
|
|
162
|
+
//# sourceMappingURL=service_locator.d.ts.map
|