@crawlee/playwright 3.0.0-alpha.2 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE.md +201 -0
- package/{README.md → dist/README.md} +0 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +73 -0
- package/dist/internals/playwright-crawler.d.ts +223 -0
- package/dist/internals/playwright-crawler.d.ts.map +1 -0
- package/dist/internals/playwright-crawler.js +108 -0
- package/dist/internals/playwright-crawler.js.map +1 -0
- package/dist/internals/playwright-launcher.d.ts +102 -0
- package/dist/internals/playwright-launcher.d.ts.map +1 -0
- package/dist/internals/playwright-launcher.js +97 -0
- package/dist/internals/playwright-launcher.js.map +1 -0
- package/dist/internals/utils/playwright-utils.d.ts +57 -0
- package/dist/internals/utils/playwright-utils.d.ts.map +1 -0
- package/dist/internals/utils/playwright-utils.js +84 -0
- package/dist/internals/utils/playwright-utils.js.map +1 -0
- package/dist/package.json +65 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +8 -7
package/dist/LICENSE.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2018 Apify Technologies s.r.o.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
File without changes
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from '@crawlee/browser';
|
|
2
|
+
export * from './internals/playwright-crawler';
|
|
3
|
+
export * from './internals/playwright-launcher';
|
|
4
|
+
export * as playwrightUtils from './internals/utils/playwright-utils';
|
|
5
|
+
export type { DirectNavigationOptions as PlaywrightDirectNavigationOptions } from './internals/utils/playwright-utils';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAEhD,OAAO,KAAK,eAAe,MAAM,oCAAoC,CAAC;AACtE,YAAY,EAAE,uBAAuB,IAAI,iCAAiC,EAAE,MAAM,oCAAoC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.playwrightUtils = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("@crawlee/browser"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./internals/playwright-crawler"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./internals/playwright-launcher"), exports);
|
|
8
|
+
exports.playwrightUtils = tslib_1.__importStar(require("./internals/utils/playwright-utils"));
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,2DAAiC;AACjC,yEAA+C;AAC/C,0EAAgD;AAEhD,8FAAsE"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import mod from "./index.js";
|
|
2
|
+
|
|
3
|
+
export default mod;
|
|
4
|
+
export const API_PROCESSED_REQUESTS_DELAY_MILLIS = mod.API_PROCESSED_REQUESTS_DELAY_MILLIS;
|
|
5
|
+
export const AutoscaledPool = mod.AutoscaledPool;
|
|
6
|
+
export const BASIC_CRAWLER_TIMEOUT_BUFFER_SECS = mod.BASIC_CRAWLER_TIMEOUT_BUFFER_SECS;
|
|
7
|
+
export const BasicCrawler = mod.BasicCrawler;
|
|
8
|
+
export const BrowserCrawler = mod.BrowserCrawler;
|
|
9
|
+
export const BrowserLauncher = mod.BrowserLauncher;
|
|
10
|
+
export const Configuration = mod.Configuration;
|
|
11
|
+
export const CookieParseError = mod.CookieParseError;
|
|
12
|
+
export const CrawlerExtension = mod.CrawlerExtension;
|
|
13
|
+
export const DATASET_ITERATORS_DEFAULT_LIMIT = mod.DATASET_ITERATORS_DEFAULT_LIMIT;
|
|
14
|
+
export const Dataset = mod.Dataset;
|
|
15
|
+
export const EVENT_SESSION_RETIRED = mod.EVENT_SESSION_RETIRED;
|
|
16
|
+
export const EnqueueStrategy = mod.EnqueueStrategy;
|
|
17
|
+
export const EventManager = mod.EventManager;
|
|
18
|
+
export const EventType = mod.EventType;
|
|
19
|
+
export const KeyValueStore = mod.KeyValueStore;
|
|
20
|
+
export const LocalEventManager = mod.LocalEventManager;
|
|
21
|
+
export const Log = mod.Log;
|
|
22
|
+
export const LogLevel = mod.LogLevel;
|
|
23
|
+
export const Logger = mod.Logger;
|
|
24
|
+
export const LoggerJson = mod.LoggerJson;
|
|
25
|
+
export const LoggerText = mod.LoggerText;
|
|
26
|
+
export const MAX_QUERIES_FOR_CONSISTENCY = mod.MAX_QUERIES_FOR_CONSISTENCY;
|
|
27
|
+
export const PlaywrightCrawler = mod.PlaywrightCrawler;
|
|
28
|
+
export const PlaywrightLauncher = mod.PlaywrightLauncher;
|
|
29
|
+
export const ProxyConfiguration = mod.ProxyConfiguration;
|
|
30
|
+
export const QUERY_HEAD_BUFFER = mod.QUERY_HEAD_BUFFER;
|
|
31
|
+
export const QUERY_HEAD_MIN_LENGTH = mod.QUERY_HEAD_MIN_LENGTH;
|
|
32
|
+
export const REQUESTS_PERSISTENCE_KEY = mod.REQUESTS_PERSISTENCE_KEY;
|
|
33
|
+
export const Request = mod.Request;
|
|
34
|
+
export const RequestList = mod.RequestList;
|
|
35
|
+
export const RequestQueue = mod.RequestQueue;
|
|
36
|
+
export const STATE_PERSISTENCE_KEY = mod.STATE_PERSISTENCE_KEY;
|
|
37
|
+
export const STATUS_CODES_BLOCKED = mod.STATUS_CODES_BLOCKED;
|
|
38
|
+
export const STORAGE_CONSISTENCY_DELAY_MILLIS = mod.STORAGE_CONSISTENCY_DELAY_MILLIS;
|
|
39
|
+
export const Session = mod.Session;
|
|
40
|
+
export const SessionPool = mod.SessionPool;
|
|
41
|
+
export const Snapshotter = mod.Snapshotter;
|
|
42
|
+
export const Statistics = mod.Statistics;
|
|
43
|
+
export const StorageManager = mod.StorageManager;
|
|
44
|
+
export const SystemStatus = mod.SystemStatus;
|
|
45
|
+
export const basicCrawlerEnqueueLinks = mod.basicCrawlerEnqueueLinks;
|
|
46
|
+
export const browserCrawlerEnqueueLinks = mod.browserCrawlerEnqueueLinks;
|
|
47
|
+
export const checkAndSerialize = mod.checkAndSerialize;
|
|
48
|
+
export const chunkBySize = mod.chunkBySize;
|
|
49
|
+
export const constructGlobObjectsFromGlobs = mod.constructGlobObjectsFromGlobs;
|
|
50
|
+
export const constructRegExpObjectsFromPseudoUrls = mod.constructRegExpObjectsFromPseudoUrls;
|
|
51
|
+
export const constructRegExpObjectsFromRegExps = mod.constructRegExpObjectsFromRegExps;
|
|
52
|
+
export const createDeserialize = mod.createDeserialize;
|
|
53
|
+
export const createRequestOptions = mod.createRequestOptions;
|
|
54
|
+
export const createRequests = mod.createRequests;
|
|
55
|
+
export const deserializeArray = mod.deserializeArray;
|
|
56
|
+
export const diffCookies = mod.diffCookies;
|
|
57
|
+
export const enqueueLinks = mod.enqueueLinks;
|
|
58
|
+
export const getCookiesFromResponse = mod.getCookiesFromResponse;
|
|
59
|
+
export const getRequestId = mod.getRequestId;
|
|
60
|
+
export const handleRequestTimeout = mod.handleRequestTimeout;
|
|
61
|
+
export const launchPlaywright = mod.launchPlaywright;
|
|
62
|
+
export const log = mod.log;
|
|
63
|
+
export const maybeStringify = mod.maybeStringify;
|
|
64
|
+
export const mergeCookies = mod.mergeCookies;
|
|
65
|
+
export const openDataset = mod.openDataset;
|
|
66
|
+
export const playwrightUtils = mod.playwrightUtils;
|
|
67
|
+
export const pushData = mod.pushData;
|
|
68
|
+
export const serializeArray = mod.serializeArray;
|
|
69
|
+
export const storage = mod.storage;
|
|
70
|
+
export const throwOnBlockedRequest = mod.throwOnBlockedRequest;
|
|
71
|
+
export const updateEnqueueLinksPatternCache = mod.updateEnqueueLinksPatternCache;
|
|
72
|
+
export const validateGlobPattern = mod.validateGlobPattern;
|
|
73
|
+
export const validators = mod.validators;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { LaunchOptions, Page, Response } from 'playwright';
|
|
2
|
+
import { PlaywrightPlugin } from '@crawlee/browser-pool';
|
|
3
|
+
import { BrowserCrawler, BrowserCrawlerOptions, BrowserCrawlingContext, BrowserCrawlerHandleRequest, BrowserHook } from '@crawlee/browser';
|
|
4
|
+
import { PlaywrightLaunchContext } from './playwright-launcher';
|
|
5
|
+
import { DirectNavigationOptions } from './utils/playwright-utils';
|
|
6
|
+
export declare type PlaywrightController = ReturnType<PlaywrightPlugin['_createController']>;
|
|
7
|
+
export declare type PlaywrightCrawlContext = BrowserCrawlingContext<Page, Response, PlaywrightController>;
|
|
8
|
+
export declare type PlaywrightHook = BrowserHook<PlaywrightCrawlContext, PlaywrightGotoOptions>;
|
|
9
|
+
export declare type PlaywrightRequestHandlerParam = BrowserCrawlingContext<Page, Response, PlaywrightController>;
|
|
10
|
+
export declare type PlaywrightRequestHandler = BrowserCrawlerHandleRequest<PlaywrightRequestHandlerParam>;
|
|
11
|
+
export declare type PlaywrightGotoOptions = Parameters<Page['goto']>[1];
|
|
12
|
+
export interface PlaywrightCrawlerOptions extends BrowserCrawlerOptions<PlaywrightCrawlContext, PlaywrightGotoOptions, {
|
|
13
|
+
browserPlugins: [PlaywrightPlugin];
|
|
14
|
+
}> {
|
|
15
|
+
/**
|
|
16
|
+
* Function that is called to process each request.
|
|
17
|
+
* It is passed an object with the following fields:
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
20
|
+
* {
|
|
21
|
+
* request: Request,
|
|
22
|
+
* response: Response,
|
|
23
|
+
* page: Page,
|
|
24
|
+
* session: Session,
|
|
25
|
+
* browserController: BrowserController,
|
|
26
|
+
* proxyInfo: ProxyInfo,
|
|
27
|
+
* crawler: PlaywrightCrawler,
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* `request` is an instance of the {@link Request} object with details about the URL to open, HTTP method etc.
|
|
32
|
+
* `page` is an instance of the `Playwright`
|
|
33
|
+
* [`Page`](https://playwright.dev/docs/api/class-page)
|
|
34
|
+
* `browserController` is an instance of the
|
|
35
|
+
* [`BrowserController`](https://github.com/apify/browser-pool#browsercontroller),
|
|
36
|
+
* `response` is an instance of the `Playwright`
|
|
37
|
+
* [`Response`](https://playwright.dev/docs/api/class-response),
|
|
38
|
+
* which is the main resource response as returned by `page.goto(request.url)`.
|
|
39
|
+
* The function must return a promise, which is then awaited by the crawler.
|
|
40
|
+
*
|
|
41
|
+
* If the function throws an exception, the crawler will try to re-crawl the
|
|
42
|
+
* request later, up to `option.maxRequestRetries` times.
|
|
43
|
+
* If all the retries fail, the crawler calls the function
|
|
44
|
+
* provided to the `handleFailedRequestFunction` parameter.
|
|
45
|
+
* To make this work, you should **always**
|
|
46
|
+
* let your function throw exceptions rather than catch them.
|
|
47
|
+
* The exceptions are logged to the request using the
|
|
48
|
+
* {@link Request.pushErrorMessage} function.
|
|
49
|
+
*/
|
|
50
|
+
requestHandler: PlaywrightRequestHandler;
|
|
51
|
+
/**
|
|
52
|
+
* Function that is called to process each request.
|
|
53
|
+
* It is passed an object with the following fields:
|
|
54
|
+
*
|
|
55
|
+
* ```
|
|
56
|
+
* {
|
|
57
|
+
* request: Request,
|
|
58
|
+
* response: Response,
|
|
59
|
+
* page: Page,
|
|
60
|
+
* session: Session,
|
|
61
|
+
* browserController: BrowserController,
|
|
62
|
+
* proxyInfo: ProxyInfo,
|
|
63
|
+
* crawler: PlaywrightCrawler,
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* `request` is an instance of the {@link Request} object with details about the URL to open, HTTP method etc.
|
|
68
|
+
* `page` is an instance of the `Playwright`
|
|
69
|
+
* [`Page`](https://playwright.dev/docs/api/class-page)
|
|
70
|
+
* `browserController` is an instance of the
|
|
71
|
+
* [`BrowserController`](https://github.com/apify/browser-pool#browsercontroller),
|
|
72
|
+
* `response` is an instance of the `Playwright`
|
|
73
|
+
* [`Response`](https://playwright.dev/docs/api/class-response),
|
|
74
|
+
* which is the main resource response as returned by `page.goto(request.url)`.
|
|
75
|
+
* The function must return a promise, which is then awaited by the crawler.
|
|
76
|
+
*
|
|
77
|
+
* If the function throws an exception, the crawler will try to re-crawl the
|
|
78
|
+
* request later, up to `option.maxRequestRetries` times.
|
|
79
|
+
* If all the retries fail, the crawler calls the function
|
|
80
|
+
* provided to the `handleFailedRequestFunction` parameter.
|
|
81
|
+
* To make this work, you should **always**
|
|
82
|
+
* let your function throw exceptions rather than catch them.
|
|
83
|
+
* The exceptions are logged to the request using the
|
|
84
|
+
* {@link Request.pushErrorMessage} function.
|
|
85
|
+
*
|
|
86
|
+
* @deprecated `handlePageFunction` has been renamed to `requestHandler` and will be removed in a future version.
|
|
87
|
+
*/
|
|
88
|
+
handlePageFunction?: PlaywrightRequestHandler;
|
|
89
|
+
/**
|
|
90
|
+
* Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies
|
|
91
|
+
* or browser properties before navigation. The function accepts two parameters, `crawlingContext` and `gotoOptions`,
|
|
92
|
+
* which are passed to the `page.goto()` function the crawler calls to navigate.
|
|
93
|
+
* Example:
|
|
94
|
+
* ```
|
|
95
|
+
* preNavigationHooks: [
|
|
96
|
+
* async (crawlingContext, gotoOptions) => {
|
|
97
|
+
* await page.evaluate((attr) => { window.foo = attr; }, 'bar');
|
|
98
|
+
* },
|
|
99
|
+
* ]
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
preNavigationHooks?: PlaywrightHook[];
|
|
103
|
+
/**
|
|
104
|
+
* Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful.
|
|
105
|
+
* The function accepts `crawlingContext` as the only parameter.
|
|
106
|
+
* Example:
|
|
107
|
+
* ```
|
|
108
|
+
* postNavigationHooks: [
|
|
109
|
+
* async (crawlingContext) => {
|
|
110
|
+
* const { page } = crawlingContext;
|
|
111
|
+
* if (hasCaptcha(page)) {
|
|
112
|
+
* await solveCaptcha (page);
|
|
113
|
+
* }
|
|
114
|
+
* },
|
|
115
|
+
* ]
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
postNavigationHooks?: PlaywrightHook[];
|
|
119
|
+
/**
|
|
120
|
+
* The same options as used by {@link launchPlaywright}.
|
|
121
|
+
*/
|
|
122
|
+
launchContext?: PlaywrightLaunchContext;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Provides a simple framework for parallel crawling of web pages
|
|
126
|
+
* using headless Chromium, Firefox and Webkit browsers with [Playwright](https://github.com/microsoft/playwright).
|
|
127
|
+
* The URLs to crawl are fed either from a static list of URLs
|
|
128
|
+
* or from a dynamic queue of URLs enabling recursive crawling of websites.
|
|
129
|
+
*
|
|
130
|
+
* Since `Playwright` uses headless browser to download web pages and extract data,
|
|
131
|
+
* it is useful for crawling of websites that require to execute JavaScript.
|
|
132
|
+
* If the target website doesn't need JavaScript, consider using {@link CheerioCrawler},
|
|
133
|
+
* which downloads the pages using raw HTTP requests and is about 10x faster.
|
|
134
|
+
*
|
|
135
|
+
* The source URLs are represented using {@link Request} objects that are fed from
|
|
136
|
+
* {@link RequestList} or {@link RequestQueue} instances provided by the {@link PlaywrightCrawlerOptions.requestList}
|
|
137
|
+
* or {@link PlaywrightCrawlerOptions.requestQueue} constructor options, respectively.
|
|
138
|
+
*
|
|
139
|
+
* If both {@link PlaywrightCrawlerOptions.requestList} and {@link PlaywrightCrawlerOptions.requestQueue} are used,
|
|
140
|
+
* the instance first processes URLs from the {@link RequestList} and automatically enqueues all of them
|
|
141
|
+
* to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
|
|
142
|
+
*
|
|
143
|
+
* The crawler finishes when there are no more {@link Request} objects to crawl.
|
|
144
|
+
*
|
|
145
|
+
* `PlaywrightCrawler` opens a new Chrome page (i.e. tab) for each {@link Request} object to crawl
|
|
146
|
+
* and then calls the function provided by user as the {@link PlaywrightCrawlerOptions.handlePageFunction} option.
|
|
147
|
+
*
|
|
148
|
+
* New pages are only opened when there is enough free CPU and memory available,
|
|
149
|
+
* using the functionality provided by the {@link AutoscaledPool} class.
|
|
150
|
+
* All {@link AutoscaledPool} configuration options can be passed to the {@link PlaywrightCrawlerOptions.autoscaledPoolOptions}
|
|
151
|
+
* parameter of the `PlaywrightCrawler` constructor. For user convenience, the `minConcurrency` and `maxConcurrency`
|
|
152
|
+
* {@link AutoscaledPoolOptions} are available directly in the `PlaywrightCrawler` constructor.
|
|
153
|
+
*
|
|
154
|
+
* Note that the pool of Playwright instances is internally managed by the [BrowserPool](https://github.com/apify/browser-pool) class.
|
|
155
|
+
*
|
|
156
|
+
* **Example usage:**
|
|
157
|
+
*
|
|
158
|
+
* ```javascript
|
|
159
|
+
* const crawler = new PlaywrightCrawler({
|
|
160
|
+
* requestList,
|
|
161
|
+
* handlePageFunction: async ({ page, request }) => {
|
|
162
|
+
* // This function is called to extract data from a single web page
|
|
163
|
+
* // 'page' is an instance of Playwright.Page with page.goto(request.url) already called
|
|
164
|
+
* // 'request' is an instance of Request class with information about the page to load
|
|
165
|
+
* await Actor.pushData({
|
|
166
|
+
* title: await page.title(),
|
|
167
|
+
* url: request.url,
|
|
168
|
+
* succeeded: true,
|
|
169
|
+
* })
|
|
170
|
+
* },
|
|
171
|
+
* handleFailedRequestFunction: async ({ request }) => {
|
|
172
|
+
* // This function is called when the crawling of a request failed too many times
|
|
173
|
+
* await Actor.pushData({
|
|
174
|
+
* url: request.url,
|
|
175
|
+
* succeeded: false,
|
|
176
|
+
* errors: request.errorMessages,
|
|
177
|
+
* })
|
|
178
|
+
* },
|
|
179
|
+
* });
|
|
180
|
+
*
|
|
181
|
+
* await crawler.run();
|
|
182
|
+
* ```
|
|
183
|
+
* @category Crawlers
|
|
184
|
+
*/
|
|
185
|
+
export declare class PlaywrightCrawler extends BrowserCrawler<{
|
|
186
|
+
browserPlugins: [PlaywrightPlugin];
|
|
187
|
+
}, LaunchOptions, PlaywrightCrawlContext> {
|
|
188
|
+
protected static optionsShape: {
|
|
189
|
+
browserPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
190
|
+
launcher: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
191
|
+
launchContext: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
192
|
+
handlePageFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
193
|
+
gotoFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
194
|
+
gotoTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
195
|
+
navigationTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
196
|
+
preNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
|
|
197
|
+
postNavigationHooks: import("ow").ArrayPredicate<unknown> & import("ow").BasePredicate<unknown[] | undefined>;
|
|
198
|
+
sessionPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
199
|
+
persistCookiesPerSession: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
|
|
200
|
+
useSessionPool: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
|
|
201
|
+
proxyConfiguration: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
202
|
+
requestList: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
203
|
+
requestQueue: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
204
|
+
requestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
205
|
+
handleRequestFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
206
|
+
requestHandlerTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
207
|
+
handleRequestTimeoutSecs: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
208
|
+
failedRequestHandler: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
209
|
+
handleFailedRequestFunction: import("ow").Predicate<Function> & import("ow").BasePredicate<Function | undefined>;
|
|
210
|
+
maxRequestRetries: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
211
|
+
maxRequestsPerCrawl: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
212
|
+
autoscaledPoolOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
213
|
+
minConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
214
|
+
maxConcurrency: import("ow").NumberPredicate & import("ow").BasePredicate<number | undefined>;
|
|
215
|
+
log: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* All `PlaywrightCrawler` parameters are passed via an options object.
|
|
219
|
+
*/
|
|
220
|
+
constructor(options: PlaywrightCrawlerOptions);
|
|
221
|
+
protected _navigationHandler(crawlingContext: PlaywrightCrawlContext, gotoOptions: DirectNavigationOptions): Promise<any>;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=playwright-crawler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright-crawler.d.ts","sourceRoot":"","sources":["../../src/internals/playwright-crawler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAsB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,EACH,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,WAAW,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAgB,MAAM,0BAA0B,CAAC;AAEjF,oBAAY,oBAAoB,GAAG,UAAU,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAErF,oBAAY,sBAAsB,GAAG,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAA;AAEjG,oBAAY,cAAc,GAAG,WAAW,CAAC,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;AAExF,oBAAY,6BAA6B,GAAG,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAA;AAExG,oBAAY,wBAAwB,GAAG,2BAA2B,CAAC,6BAA6B,CAAC,CAAC;AAElG,oBAAY,qBAAqB,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhE,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB,CACnE,sBAAsB,EACtB,qBAAqB,EACrB;IAAE,cAAc,EAAE,CAAC,gBAAgB,CAAC,CAAA;CAAE,CACzC;IACG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,cAAc,EAAE,wBAAwB,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAE9C;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC;IAEtC;;;;;;;;;;;;;;OAcG;IACH,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAC;IAEvC;;OAEG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;CAM3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC;IAAE,cAAc,EAAE,CAAC,gBAAgB,CAAC,CAAA;CAAE,EAAE,aAAa,EAAE,sBAAsB,CAAC;IAChI,iBAA0B,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKpC;IAEF;;OAEG;gBACS,OAAO,EAAE,wBAAwB;cAuBpB,kBAAkB,CAAC,eAAe,EAAE,sBAAsB,EAAE,WAAW,EAAE,uBAAuB;CAQ5H"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlaywrightCrawler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
6
|
+
const browser_1 = require("@crawlee/browser");
|
|
7
|
+
const playwright_launcher_1 = require("./playwright-launcher");
|
|
8
|
+
const playwright_utils_1 = require("./utils/playwright-utils");
|
|
9
|
+
/**
|
|
10
|
+
* Provides a simple framework for parallel crawling of web pages
|
|
11
|
+
* using headless Chromium, Firefox and Webkit browsers with [Playwright](https://github.com/microsoft/playwright).
|
|
12
|
+
* The URLs to crawl are fed either from a static list of URLs
|
|
13
|
+
* or from a dynamic queue of URLs enabling recursive crawling of websites.
|
|
14
|
+
*
|
|
15
|
+
* Since `Playwright` uses headless browser to download web pages and extract data,
|
|
16
|
+
* it is useful for crawling of websites that require to execute JavaScript.
|
|
17
|
+
* If the target website doesn't need JavaScript, consider using {@link CheerioCrawler},
|
|
18
|
+
* which downloads the pages using raw HTTP requests and is about 10x faster.
|
|
19
|
+
*
|
|
20
|
+
* The source URLs are represented using {@link Request} objects that are fed from
|
|
21
|
+
* {@link RequestList} or {@link RequestQueue} instances provided by the {@link PlaywrightCrawlerOptions.requestList}
|
|
22
|
+
* or {@link PlaywrightCrawlerOptions.requestQueue} constructor options, respectively.
|
|
23
|
+
*
|
|
24
|
+
* If both {@link PlaywrightCrawlerOptions.requestList} and {@link PlaywrightCrawlerOptions.requestQueue} are used,
|
|
25
|
+
* the instance first processes URLs from the {@link RequestList} and automatically enqueues all of them
|
|
26
|
+
* to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
|
|
27
|
+
*
|
|
28
|
+
* The crawler finishes when there are no more {@link Request} objects to crawl.
|
|
29
|
+
*
|
|
30
|
+
* `PlaywrightCrawler` opens a new Chrome page (i.e. tab) for each {@link Request} object to crawl
|
|
31
|
+
* and then calls the function provided by user as the {@link PlaywrightCrawlerOptions.handlePageFunction} option.
|
|
32
|
+
*
|
|
33
|
+
* New pages are only opened when there is enough free CPU and memory available,
|
|
34
|
+
* using the functionality provided by the {@link AutoscaledPool} class.
|
|
35
|
+
* All {@link AutoscaledPool} configuration options can be passed to the {@link PlaywrightCrawlerOptions.autoscaledPoolOptions}
|
|
36
|
+
* parameter of the `PlaywrightCrawler` constructor. For user convenience, the `minConcurrency` and `maxConcurrency`
|
|
37
|
+
* {@link AutoscaledPoolOptions} are available directly in the `PlaywrightCrawler` constructor.
|
|
38
|
+
*
|
|
39
|
+
* Note that the pool of Playwright instances is internally managed by the [BrowserPool](https://github.com/apify/browser-pool) class.
|
|
40
|
+
*
|
|
41
|
+
* **Example usage:**
|
|
42
|
+
*
|
|
43
|
+
* ```javascript
|
|
44
|
+
* const crawler = new PlaywrightCrawler({
|
|
45
|
+
* requestList,
|
|
46
|
+
* handlePageFunction: async ({ page, request }) => {
|
|
47
|
+
* // This function is called to extract data from a single web page
|
|
48
|
+
* // 'page' is an instance of Playwright.Page with page.goto(request.url) already called
|
|
49
|
+
* // 'request' is an instance of Request class with information about the page to load
|
|
50
|
+
* await Actor.pushData({
|
|
51
|
+
* title: await page.title(),
|
|
52
|
+
* url: request.url,
|
|
53
|
+
* succeeded: true,
|
|
54
|
+
* })
|
|
55
|
+
* },
|
|
56
|
+
* handleFailedRequestFunction: async ({ request }) => {
|
|
57
|
+
* // This function is called when the crawling of a request failed too many times
|
|
58
|
+
* await Actor.pushData({
|
|
59
|
+
* url: request.url,
|
|
60
|
+
* succeeded: false,
|
|
61
|
+
* errors: request.errorMessages,
|
|
62
|
+
* })
|
|
63
|
+
* },
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* await crawler.run();
|
|
67
|
+
* ```
|
|
68
|
+
* @category Crawlers
|
|
69
|
+
*/
|
|
70
|
+
class PlaywrightCrawler extends browser_1.BrowserCrawler {
|
|
71
|
+
/**
|
|
72
|
+
* All `PlaywrightCrawler` parameters are passed via an options object.
|
|
73
|
+
*/
|
|
74
|
+
constructor(options) {
|
|
75
|
+
(0, ow_1.default)(options, 'PlaywrightCrawlerOptions', ow_1.default.object.exactShape(PlaywrightCrawler.optionsShape));
|
|
76
|
+
const { launchContext = {}, browserPoolOptions = {}, ...browserCrawlerOptions } = options;
|
|
77
|
+
if (launchContext.proxyUrl) {
|
|
78
|
+
throw new Error('PlaywrightCrawlerOptions.launchContext.proxyUrl is not allowed in PlaywrightCrawler.'
|
|
79
|
+
+ 'Use PlaywrightCrawlerOptions.proxyConfiguration');
|
|
80
|
+
}
|
|
81
|
+
const playwrightLauncher = new playwright_launcher_1.PlaywrightLauncher(launchContext);
|
|
82
|
+
browserPoolOptions.browserPlugins = [
|
|
83
|
+
playwrightLauncher.createBrowserPlugin(),
|
|
84
|
+
];
|
|
85
|
+
super({ ...browserCrawlerOptions, browserPoolOptions });
|
|
86
|
+
this.launchContext = launchContext;
|
|
87
|
+
}
|
|
88
|
+
async _navigationHandler(crawlingContext, gotoOptions) {
|
|
89
|
+
if (this.gotoFunction) {
|
|
90
|
+
this.log.deprecated('PlaywrightCrawler.gotoFunction is deprecated. Use "preNavigationHooks" and "postNavigationHooks" instead.');
|
|
91
|
+
return this.gotoFunction(crawlingContext, gotoOptions);
|
|
92
|
+
}
|
|
93
|
+
return (0, playwright_utils_1.gotoExtended)(crawlingContext.page, crawlingContext.request, gotoOptions);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.PlaywrightCrawler = PlaywrightCrawler;
|
|
97
|
+
Object.defineProperty(PlaywrightCrawler, "optionsShape", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
configurable: true,
|
|
100
|
+
writable: true,
|
|
101
|
+
value: {
|
|
102
|
+
...browser_1.BrowserCrawler.optionsShape,
|
|
103
|
+
browserPoolOptions: ow_1.default.optional.object,
|
|
104
|
+
launcher: ow_1.default.optional.object,
|
|
105
|
+
launchContext: ow_1.default.optional.object,
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=playwright-crawler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright-crawler.js","sourceRoot":"","sources":["../../src/internals/playwright-crawler.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AAIpB,8CAM0B;AAC1B,+DAAoF;AACpF,+DAAiF;AA0IjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAa,iBAAkB,SAAQ,wBAA6F;IAQhI;;OAEG;IACH,YAAY,OAAiC;QACzC,IAAA,YAAE,EAAC,OAAO,EAAE,0BAA0B,EAAE,YAAE,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC;QAE9F,MAAM,EACF,aAAa,GAAG,EAAE,EAClB,kBAAkB,GAAG,EAA0C,EAC/D,GAAG,qBAAqB,EAC3B,GAAG,OAAO,CAAC;QAEZ,IAAI,aAAa,CAAC,QAAQ,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,sFAAsF;kBAChG,iDAAiD,CAAC,CAAC;SAC5D;QACD,MAAM,kBAAkB,GAAG,IAAI,wCAAkB,CAAC,aAAa,CAAC,CAAC;QAEjE,kBAAkB,CAAC,cAAc,GAAG;YAChC,kBAAkB,CAAC,mBAAmB,EAAE;SAC3C,CAAC;QAEF,KAAK,CAAC,EAAE,GAAG,qBAAqB,EAAE,kBAAkB,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACvC,CAAC;IAEkB,KAAK,CAAC,kBAAkB,CAAC,eAAuC,EAAE,WAAoC;QACrH,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,2GAA2G,CAAC,CAAC;YACjI,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,WAAyB,CAAC,CAAC;SACxE;QAED,OAAO,IAAA,+BAAY,EAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACpF,CAAC;;AAzCL,8CA0CC;AAzCG;;;;WAAyC;QACrC,GAAG,wBAAc,CAAC,YAAY;QAC9B,kBAAkB,EAAE,YAAE,CAAC,QAAQ,CAAC,MAAM;QACtC,QAAQ,EAAE,YAAE,CAAC,QAAQ,CAAC,MAAM;QAC5B,aAAa,EAAE,YAAE,CAAC,QAAQ,CAAC,MAAM;KACpC;GAAC"}
|