@crawlee/browser 3.0.0-alpha.2 → 3.0.0-alpha.20

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.
@@ -0,0 +1,423 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.browserCrawlerEnqueueLinks = exports.BrowserCrawler = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const timeout_1 = require("@apify/timeout");
6
+ const core_1 = require("@crawlee/core");
7
+ const basic_1 = require("@crawlee/basic");
8
+ const browser_pool_1 = require("@crawlee/browser-pool");
9
+ const ow_1 = tslib_1.__importDefault(require("ow"));
10
+ const tough_cookie_1 = require("tough-cookie");
11
+ /**
12
+ * Provides a simple framework for parallel crawling of web pages
13
+ * using headless browsers with [Puppeteer](https://github.com/puppeteer/puppeteer)
14
+ * and [Playwright](https://github.com/microsoft/playwright).
15
+ * The URLs to crawl are fed either from a static list of URLs
16
+ * or from a dynamic queue of URLs enabling recursive crawling of websites.
17
+ *
18
+ * Since `BrowserCrawler` uses headless or even headfull browsers to download web pages and extract data,
19
+ * it is useful for crawling of websites that require to execute JavaScript.
20
+ * If the target website doesn't need JavaScript, consider using {@link CheerioCrawler},
21
+ * which downloads the pages using raw HTTP requests and is about 10x faster.
22
+ *
23
+ * The source URLs are represented using {@link Request} objects that are fed from
24
+ * {@link RequestList} or {@link RequestQueue} instances provided by the {@link BrowserCrawlerOptions.requestList}
25
+ * or {@link BrowserCrawlerOptions.requestQueue} constructor options, respectively.
26
+ *
27
+ * If both {@link BrowserCrawlerOptions.requestList} and {@link BrowserCrawlerOptions.requestQueue} are used,
28
+ * the instance first processes URLs from the {@link RequestList} and automatically enqueues all of them
29
+ * to {@link RequestQueue} before it starts their processing. This ensures that a single URL is not crawled multiple times.
30
+ *
31
+ * The crawler finishes when there are no more {@link Request} objects to crawl.
32
+ *
33
+ * `BrowserCrawler` opens a new browser page (i.e. tab or window) for each {@link Request} object to crawl
34
+ * and then calls the function provided by user as the {@link BrowserCrawlerOptions.handlePageFunction} option.
35
+ *
36
+ * New pages are only opened when there is enough free CPU and memory available,
37
+ * using the functionality provided by the {@link AutoscaledPool} class.
38
+ * All {@link AutoscaledPool} configuration options can be passed to the {@link BrowserCrawlerOptions.autoscaledPoolOptions}
39
+ * parameter of the `BrowserCrawler` constructor. For user convenience, the `minConcurrency` and `maxConcurrency`
40
+ * {@link AutoscaledPoolOptions} are available directly in the `BrowserCrawler` constructor.
41
+ *
42
+ * Note that the pool of browser instances is internally managed by the [BrowserPool](https://github.com/apify/browser-pool) class.
43
+ * ```js
44
+ * await crawler.run();
45
+ * ```
46
+ * @category Crawlers
47
+ */
48
+ class BrowserCrawler extends basic_1.BasicCrawler {
49
+ /**
50
+ * All `BrowserCrawler` parameters are passed via an options object.
51
+ */
52
+ constructor(options) {
53
+ (0, ow_1.default)(options, 'BrowserCrawlerOptions', ow_1.default.object.exactShape(BrowserCrawler.optionsShape));
54
+ const { navigationTimeoutSecs = 60, requestHandlerTimeoutSecs = 60, gotoFunction, // deprecated
55
+ gotoTimeoutSecs, // deprecated
56
+ persistCookiesPerSession, proxyConfiguration, launchContext, browserPoolOptions, preNavigationHooks = [], postNavigationHooks = [],
57
+ // Ignored
58
+ handleRequestFunction, requestHandler: userProvidedRequestHandler, handlePageFunction, failedRequestHandler, handleFailedRequestFunction, ...basicCrawlerOptions } = options;
59
+ super({
60
+ ...basicCrawlerOptions,
61
+ requestHandler: (...args) => this._runRequestHandler(...args),
62
+ requestHandlerTimeoutSecs: navigationTimeoutSecs + requestHandlerTimeoutSecs + basic_1.BASIC_CRAWLER_TIMEOUT_BUFFER_SECS,
63
+ });
64
+ /**
65
+ * A reference to the underlying {@link ProxyConfiguration} class that manages the crawler's proxies.
66
+ * Only available if used by the crawler.
67
+ */
68
+ Object.defineProperty(this, "proxyConfiguration", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: void 0
73
+ });
74
+ /**
75
+ * A reference to the underlying `BrowserPool` class that manages the crawler's browsers.
76
+ * For more information about it, see the [`browser-pool` module](https://github.com/apify/browser-pool).
77
+ * @todo the type is almost unusable with so many generic arguments, what should go there? we need inference
78
+ */
79
+ Object.defineProperty(this, "browserPool", {
80
+ enumerable: true,
81
+ configurable: true,
82
+ writable: true,
83
+ value: void 0
84
+ });
85
+ Object.defineProperty(this, "launchContext", {
86
+ enumerable: true,
87
+ configurable: true,
88
+ writable: true,
89
+ value: void 0
90
+ });
91
+ Object.defineProperty(this, "userProvidedRequestHandler", {
92
+ enumerable: true,
93
+ configurable: true,
94
+ writable: true,
95
+ value: void 0
96
+ });
97
+ Object.defineProperty(this, "navigationTimeoutMillis", {
98
+ enumerable: true,
99
+ configurable: true,
100
+ writable: true,
101
+ value: void 0
102
+ });
103
+ Object.defineProperty(this, "gotoFunction", {
104
+ enumerable: true,
105
+ configurable: true,
106
+ writable: true,
107
+ value: void 0
108
+ });
109
+ Object.defineProperty(this, "defaultGotoOptions", {
110
+ enumerable: true,
111
+ configurable: true,
112
+ writable: true,
113
+ value: void 0
114
+ });
115
+ Object.defineProperty(this, "preNavigationHooks", {
116
+ enumerable: true,
117
+ configurable: true,
118
+ writable: true,
119
+ value: void 0
120
+ });
121
+ Object.defineProperty(this, "postNavigationHooks", {
122
+ enumerable: true,
123
+ configurable: true,
124
+ writable: true,
125
+ value: void 0
126
+ });
127
+ Object.defineProperty(this, "persistCookiesPerSession", {
128
+ enumerable: true,
129
+ configurable: true,
130
+ writable: true,
131
+ value: void 0
132
+ });
133
+ this._handlePropertyNameChange({
134
+ newName: 'requestHandler',
135
+ oldName: 'handlePageFunction',
136
+ propertyKey: 'userProvidedRequestHandler',
137
+ newProperty: userProvidedRequestHandler,
138
+ oldProperty: handlePageFunction,
139
+ });
140
+ this._handlePropertyNameChange({
141
+ newName: 'failedRequestHandler',
142
+ oldName: 'handleFailedRequestFunction',
143
+ propertyKey: 'failedRequestHandler',
144
+ newProperty: failedRequestHandler,
145
+ oldProperty: handleFailedRequestFunction,
146
+ allowUndefined: true,
147
+ });
148
+ // Cookies should be persisted per session only if session pool is used
149
+ if (!this.useSessionPool && persistCookiesPerSession) {
150
+ throw new Error('You cannot use "persistCookiesPerSession" without "useSessionPool" set to true.');
151
+ }
152
+ if (gotoTimeoutSecs) {
153
+ this.log.deprecated('Option "gotoTimeoutSecs" is deprecated. Use "navigationTimeoutSecs" instead.');
154
+ }
155
+ this.launchContext = launchContext;
156
+ this.navigationTimeoutMillis = (gotoTimeoutSecs || navigationTimeoutSecs) * 1000;
157
+ this.gotoFunction = gotoFunction;
158
+ this.defaultGotoOptions = {
159
+ timeout: this.navigationTimeoutMillis,
160
+ };
161
+ this.proxyConfiguration = proxyConfiguration;
162
+ this.preNavigationHooks = preNavigationHooks;
163
+ this.postNavigationHooks = postNavigationHooks;
164
+ if (this.useSessionPool) {
165
+ this.persistCookiesPerSession = persistCookiesPerSession !== undefined ? persistCookiesPerSession : true;
166
+ }
167
+ else {
168
+ this.persistCookiesPerSession = false;
169
+ }
170
+ if (launchContext?.userAgent) {
171
+ browserPoolOptions.useFingerprints = false;
172
+ this.log.info('Disabling automatic fingerprint injection because custom user agent has been provided.');
173
+ }
174
+ const { preLaunchHooks = [], postLaunchHooks = [], ...rest } = browserPoolOptions;
175
+ this.browserPool = new browser_pool_1.BrowserPool({
176
+ ...rest,
177
+ preLaunchHooks: [
178
+ this._extendLaunchContext.bind(this),
179
+ ...preLaunchHooks,
180
+ ],
181
+ postLaunchHooks: [
182
+ this._maybeAddSessionRetiredListener.bind(this),
183
+ ...postLaunchHooks,
184
+ ],
185
+ });
186
+ }
187
+ /**
188
+ * Wrapper around handlePageFunction that opens and closes pages etc.
189
+ */
190
+ async _runRequestHandler(crawlingContext) {
191
+ const newPageOptions = {
192
+ id: crawlingContext.id,
193
+ };
194
+ const useIncognitoPages = this.launchContext?.useIncognitoPages;
195
+ if (this.proxyConfiguration && useIncognitoPages) {
196
+ const { session } = crawlingContext;
197
+ const proxyInfo = await this.proxyConfiguration.newProxyInfo(session?.id);
198
+ crawlingContext.proxyInfo = proxyInfo;
199
+ newPageOptions.proxyUrl = proxyInfo.url;
200
+ if (this.proxyConfiguration.isManInTheMiddle) {
201
+ /**
202
+ * @see https://playwright.dev/docs/api/class-browser/#browser-new-context
203
+ * @see https://github.com/puppeteer/puppeteer/blob/main/docs/api.md
204
+ */
205
+ newPageOptions.pageOptions = {
206
+ ignoreHTTPSErrors: true,
207
+ };
208
+ }
209
+ }
210
+ const page = await this.browserPool.newPage(newPageOptions);
211
+ (0, timeout_1.tryCancel)();
212
+ this._enhanceCrawlingContextWithPageInfo(crawlingContext, page, useIncognitoPages);
213
+ // DO NOT MOVE THIS LINE ABOVE!
214
+ // `enhanceCrawlingContextWithPageInfo` gives us a valid session.
215
+ // For example, `sessionPoolOptions.sessionOptions.maxUsageCount` can be `1`.
216
+ // So we must not save the session prior to making sure it was used only once, otherwise we would use it twice.
217
+ const { request, session } = crawlingContext;
218
+ try {
219
+ await this._handleNavigation(crawlingContext);
220
+ (0, timeout_1.tryCancel)();
221
+ await this._responseHandler(crawlingContext);
222
+ (0, timeout_1.tryCancel)();
223
+ // save cookies
224
+ // TODO: Should we save the cookies also after/only the handle page?
225
+ if (this.persistCookiesPerSession) {
226
+ const cookies = await crawlingContext.browserController.getCookies(page);
227
+ (0, timeout_1.tryCancel)();
228
+ session?.setPuppeteerCookies(cookies, request.loadedUrl);
229
+ }
230
+ await (0, timeout_1.addTimeoutToPromise)(() => Promise.resolve(this.userProvidedRequestHandler(crawlingContext)), this.requestHandlerTimeoutMillis, `requestHandler timed out after ${this.requestHandlerTimeoutMillis / 1000} seconds.`);
231
+ (0, timeout_1.tryCancel)();
232
+ if (session)
233
+ session.markGood();
234
+ }
235
+ finally {
236
+ page.close().catch((error) => this.log.debug('Error while closing page', { error }));
237
+ }
238
+ }
239
+ _enhanceCrawlingContextWithPageInfo(crawlingContext, page, useIncognitoPages) {
240
+ crawlingContext.page = page;
241
+ // This switch is because the crawlingContexts are created on per request basis.
242
+ // However, we need to add the proxy info and session from browser, which is created based on the browser-pool configuration.
243
+ // We would not have to do this switch if the proxy and configuration worked as in CheerioCrawler,
244
+ // which configures proxy and session for every new request
245
+ const browserControllerInstance = this.browserPool.getBrowserControllerByPage(page);
246
+ crawlingContext.browserController = browserControllerInstance;
247
+ if (!useIncognitoPages) {
248
+ crawlingContext.session = browserControllerInstance.launchContext.session;
249
+ }
250
+ if (!crawlingContext.proxyInfo) {
251
+ crawlingContext.proxyInfo = browserControllerInstance.launchContext.proxyInfo;
252
+ }
253
+ crawlingContext.enqueueLinks = async (enqueueOptions) => {
254
+ return browserCrawlerEnqueueLinks({
255
+ options: enqueueOptions,
256
+ page,
257
+ requestQueue: await this.getRequestQueue(),
258
+ originalRequestUrl: new URL(crawlingContext.request.url).origin,
259
+ finalRequestUrl: new URL(crawlingContext.request.loadedUrl ?? crawlingContext.request.url).origin,
260
+ });
261
+ };
262
+ }
263
+ async _handleNavigation(crawlingContext) {
264
+ const gotoOptions = { ...this.defaultGotoOptions };
265
+ const preNavigationHooksCookies = this._getCookieHeaderFromRequest(crawlingContext.request);
266
+ await this._executeHooks(this.preNavigationHooks, crawlingContext, gotoOptions);
267
+ (0, timeout_1.tryCancel)();
268
+ const postNavigationHooksCookies = this._getCookieHeaderFromRequest(crawlingContext.request);
269
+ await this._applyCookies(crawlingContext, preNavigationHooksCookies, postNavigationHooksCookies);
270
+ try {
271
+ crawlingContext.response = await this._navigationHandler(crawlingContext, gotoOptions);
272
+ }
273
+ catch (error) {
274
+ this._handleNavigationTimeout(crawlingContext, error);
275
+ throw error;
276
+ }
277
+ (0, timeout_1.tryCancel)();
278
+ await this._executeHooks(this.postNavigationHooks, crawlingContext, gotoOptions);
279
+ }
280
+ async _applyCookies({ session, request, page, browserController }, preHooksCookies, postHooksCookies) {
281
+ const sessionCookie = session?.getPuppeteerCookies(request.url) ?? [];
282
+ const parsedPreHooksCookies = preHooksCookies.split(/ *; */).map((c) => tough_cookie_1.Cookie.parse(c)?.toJSON());
283
+ const parsedPostHooksCookies = postHooksCookies.split(/ *; */).map((c) => tough_cookie_1.Cookie.parse(c)?.toJSON());
284
+ await browserController.setCookies(page, [
285
+ ...sessionCookie,
286
+ ...parsedPreHooksCookies,
287
+ ...parsedPostHooksCookies,
288
+ ].filter((c) => typeof c !== 'undefined'));
289
+ }
290
+ /**
291
+ * Marks session bad in case of navigation timeout.
292
+ */
293
+ _handleNavigationTimeout(crawlingContext, error) {
294
+ const { session } = crawlingContext;
295
+ if (error && error.constructor.name === 'TimeoutError') {
296
+ (0, core_1.handleRequestTimeout)({ session, errorMessage: error.message });
297
+ }
298
+ }
299
+ async _navigationHandler(crawlingContext, gotoOptions) {
300
+ if (!this.gotoFunction) {
301
+ // @TODO: although it is optional in the validation,
302
+ // because when you make automation library specific you can override this handler.
303
+ throw new Error('BrowserCrawler: You must specify a gotoFunction!');
304
+ }
305
+ return this.gotoFunction(crawlingContext, gotoOptions);
306
+ }
307
+ /**
308
+ * Should be overridden in case of different automation library that does not support this response API.
309
+ * @todo: This can be also done as a postNavigation hook except the loadedUrl marking.
310
+ */
311
+ async _responseHandler(crawlingContext) {
312
+ const { response, session, request, page } = crawlingContext;
313
+ if (this.sessionPool && response && session) {
314
+ if (typeof response === 'object' && typeof response.status === 'function') {
315
+ (0, core_1.throwOnBlockedRequest)(session, response.status());
316
+ }
317
+ else {
318
+ this.log.debug('Got a malformed Browser response.', { request, response });
319
+ }
320
+ }
321
+ request.loadedUrl = await page.url();
322
+ }
323
+ async _extendLaunchContext(_pageId, launchContext) {
324
+ const launchContextExtends = {};
325
+ if (this.sessionPool) {
326
+ launchContextExtends.session = await this.sessionPool.getSession();
327
+ }
328
+ if (this.proxyConfiguration) {
329
+ const proxyInfo = await this.proxyConfiguration.newProxyInfo(launchContextExtends.session?.id);
330
+ launchContext.proxyUrl = proxyInfo.url;
331
+ launchContextExtends.proxyInfo = proxyInfo;
332
+ // Disable SSL verification for MITM proxies
333
+ if (this.proxyConfiguration.isManInTheMiddle) {
334
+ /**
335
+ * @see https://playwright.dev/docs/api/class-browser/#browser-new-context
336
+ * @see https://github.com/puppeteer/puppeteer/blob/main/docs/api.md
337
+ */
338
+ launchContext.launchOptions.ignoreHTTPSErrors = true;
339
+ }
340
+ }
341
+ launchContext.extend(launchContextExtends);
342
+ }
343
+ _maybeAddSessionRetiredListener(_pageId, browserController) {
344
+ if (this.sessionPool) {
345
+ const listener = (session) => {
346
+ const { launchContext } = browserController;
347
+ if (session.id === launchContext.session.id) {
348
+ this.browserPool.retireBrowserController(browserController);
349
+ }
350
+ };
351
+ this.sessionPool.on(core_1.EVENT_SESSION_RETIRED, listener);
352
+ browserController.on("browserClosed" /* BROWSER_CLOSED */, () => {
353
+ return this.sessionPool.removeListener(core_1.EVENT_SESSION_RETIRED, listener);
354
+ });
355
+ }
356
+ }
357
+ /**
358
+ * Function for cleaning up after all request are processed.
359
+ * @ignore
360
+ */
361
+ async teardown() {
362
+ await this.browserPool.destroy();
363
+ await super.teardown();
364
+ }
365
+ }
366
+ exports.BrowserCrawler = BrowserCrawler;
367
+ Object.defineProperty(BrowserCrawler, "optionsShape", {
368
+ enumerable: true,
369
+ configurable: true,
370
+ writable: true,
371
+ value: {
372
+ ...basic_1.BasicCrawler.optionsShape,
373
+ handlePageFunction: ow_1.default.optional.function,
374
+ gotoFunction: ow_1.default.optional.function,
375
+ gotoTimeoutSecs: ow_1.default.optional.number.greaterThan(0),
376
+ navigationTimeoutSecs: ow_1.default.optional.number.greaterThan(0),
377
+ preNavigationHooks: ow_1.default.optional.array,
378
+ postNavigationHooks: ow_1.default.optional.array,
379
+ launchContext: ow_1.default.optional.object,
380
+ browserPoolOptions: ow_1.default.object,
381
+ sessionPoolOptions: ow_1.default.optional.object,
382
+ persistCookiesPerSession: ow_1.default.optional.boolean,
383
+ useSessionPool: ow_1.default.optional.boolean,
384
+ proxyConfiguration: ow_1.default.optional.object.validate(core_1.validators.proxyConfiguration),
385
+ }
386
+ });
387
+ /** @internal */
388
+ async function browserCrawlerEnqueueLinks({ options, page, requestQueue, originalRequestUrl, finalRequestUrl, }) {
389
+ const baseUrl = (0, core_1.resolveBaseUrl)({
390
+ enqueueStrategy: options?.strategy,
391
+ finalRequestUrl,
392
+ originalRequestUrl,
393
+ userProvidedBaseUrl: options?.baseUrl,
394
+ });
395
+ const urls = await extractUrlsFromPage(page, options?.selector ?? 'a', baseUrl);
396
+ return (0, core_1.enqueueLinks)({
397
+ requestQueue,
398
+ urls,
399
+ baseUrl,
400
+ ...options,
401
+ });
402
+ }
403
+ exports.browserCrawlerEnqueueLinks = browserCrawlerEnqueueLinks;
404
+ /**
405
+ * Extracts URLs from a given page.
406
+ * @ignore
407
+ */
408
+ // eslint-disable-next-line @typescript-eslint/ban-types
409
+ async function extractUrlsFromPage(page, selector, baseUrl) {
410
+ const urls = await page.$$eval(selector, (linkEls) => linkEls.map((link) => link.getAttribute('href')).filter((href) => !!href));
411
+ return urls.map((href) => {
412
+ // Throw a meaningful error when only a relative URL would be extracted instead of waiting for the Request to fail later.
413
+ const isHrefAbsolute = /^[a-z][a-z0-9+.-]*:/.test(href); // Grabbed this in 'is-absolute-url' package.
414
+ if (!isHrefAbsolute && !baseUrl) {
415
+ throw new Error(`An extracted URL: ${href} is relative and options.baseUrl is not set. `
416
+ + 'Use options.baseUrl in enqueueLinks() to automatically resolve relative URLs.');
417
+ }
418
+ return baseUrl
419
+ ? (new URL(href, baseUrl)).href
420
+ : href;
421
+ });
422
+ }
423
+ //# sourceMappingURL=browser-crawler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-crawler.js","sourceRoot":"","sources":["../../src/internals/browser-crawler.ts"],"names":[],"mappings":";;;;AAAA,4CAAgE;AAChE,wCAeuB;AACvB,0CAIwB;AAExB,wDAW+B;AAC/B,oDAAoB;AACpB,+CAAsC;AAyPtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAsB,cAKpB,SAAQ,oBAAqB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wD;AACxD,KAAK,UAAU,mBAAmB,CAAC,IAA0B,EAAE,QAAgB,EAAE,OAAgB;IAC7F,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,OAA0B,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAEpJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;QAC7B,yHAAyH;QACzH,MAAM,cAAc,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,6CAA6C;QACtG,IAAI,CAAC,cAAc,IAAI,CAAC,OAAO,EAAE;YAC7B,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,+CAA+C;kBAC9E,+EAA+E,CAAC,CAAC;SAC9F;QACD,OAAO,OAAO;YACV,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI;YAC/B,CAAC,CAAC,IAAI,CAAC;IACf,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { Dictionary, Constructor } from '@crawlee/utils';
2
+ import { BrowserPlugin, BrowserPluginOptions } from '@crawlee/browser-pool';
3
+ export interface BrowserLaunchContext<TOptions, Launcher> extends BrowserPluginOptions<TOptions> {
4
+ /**
5
+ * URL to a HTTP proxy server. It must define the port number,
6
+ * and it may also contain proxy username and password.
7
+ *
8
+ * Example: `http://bob:pass123@proxy.example.com:1234`.
9
+ */
10
+ proxyUrl?: string;
11
+ /**
12
+ * If `true` and `executablePath` is not set,
13
+ * the launcher will launch full Google Chrome browser available on the machine
14
+ * rather than the bundled Chromium. The path to Chrome executable
15
+ * is taken from the `APIFY_CHROME_EXECUTABLE_PATH` environment variable if provided,
16
+ * or defaults to the typical Google Chrome executable location specific for the operating system.
17
+ * By default, this option is `false`.
18
+ * @default false
19
+ */
20
+ useChrome?: boolean;
21
+ /**
22
+ * With this option selected, all pages will be opened in a new incognito browser context.
23
+ * This means they will not share cookies nor cache and their resources will not be throttled by one another.
24
+ * @default false
25
+ */
26
+ useIncognitoPages?: boolean;
27
+ /**
28
+ * Sets the [User Data Directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) path.
29
+ * The user data directory contains profile data such as history, bookmarks, and cookies, as well as other per-installation local state.
30
+ * If not specified, a temporary directory is used instead.
31
+ */
32
+ userDataDir?: string;
33
+ /**
34
+ * The `User-Agent` HTTP header used by the browser.
35
+ * If not provided, the function sets `User-Agent` to a reasonable default
36
+ * to reduce the chance of detection of the crawler.
37
+ */
38
+ userAgent?: string;
39
+ launcher?: Launcher;
40
+ }
41
+ /**
42
+ * Abstract class for creating browser launchers, such as `PlaywrightLauncher` and `PuppeteerLauncher`.
43
+ * @ignore
44
+ */
45
+ export declare abstract class BrowserLauncher<Plugin extends BrowserPlugin, Launcher = Plugin['library'], T extends Constructor<Plugin> = Constructor<Plugin>, LaunchOptions = Partial<Parameters<Plugin['launch']>[0]>, LaunchResult extends ReturnType<Plugin['launch']> = ReturnType<Plugin['launch']>> {
46
+ launcher: Launcher;
47
+ proxyUrl?: string;
48
+ useChrome?: boolean;
49
+ launchOptions: Dictionary;
50
+ otherLaunchContextProps: Dictionary;
51
+ Plugin: T;
52
+ userAgent?: string;
53
+ protected static optionsShape: {
54
+ proxyUrl: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
55
+ useChrome: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
56
+ useIncognitoPages: import("ow").BooleanPredicate & import("ow").BasePredicate<boolean | undefined>;
57
+ userDataDir: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
58
+ launchOptions: import("ow").ObjectPredicate<object> & import("ow").BasePredicate<object | undefined>;
59
+ userAgent: import("ow").StringPredicate & import("ow").BasePredicate<string | undefined>;
60
+ };
61
+ static requireLauncherOrThrow<T>(launcher: string, apifyImageName: string): T;
62
+ /**
63
+ * All `BrowserLauncher` parameters are passed via an launchContext object.
64
+ */
65
+ constructor(launchContext: BrowserLaunchContext<LaunchOptions, Launcher>);
66
+ /**
67
+ * @ignore
68
+ */
69
+ createBrowserPlugin(): Plugin;
70
+ /**
71
+ * Launches a browser instance based on the plugin.
72
+ * @returns Browser instance.
73
+ */
74
+ launch(): LaunchResult;
75
+ createLaunchOptions(): Dictionary;
76
+ protected _getDefaultHeadlessOption(): boolean;
77
+ protected _getChromeExecutablePath(): string;
78
+ /**
79
+ * Gets a typical path to Chrome executable, depending on the current operating system.
80
+ */
81
+ protected _getTypicalChromeExecutablePath(): string;
82
+ protected _validateProxyUrlProtocol(proxyUrl?: string): void;
83
+ }
84
+ //# sourceMappingURL=browser-launcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-launcher.d.ts","sourceRoot":"","sources":["../../src/internals/browser-launcher.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,UAAU,EACV,WAAW,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,aAAa,EACb,oBAAoB,EACvB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,WAAW,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAE,SAAQ,oBAAoB,CAAC,QAAQ,CAAC;IAC5F;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;MAIE;IACF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;MAIE;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACvB;AAED;;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