@crawlee/playwright 4.0.0-beta.151 → 4.0.0-beta.153
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.
|
@@ -8,7 +8,7 @@ import type { AnyNode } from 'domhandler';
|
|
|
8
8
|
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
9
9
|
import type { Page } from 'playwright';
|
|
10
10
|
import { z } from 'zod';
|
|
11
|
-
import type { PlaywrightCrawlingContext, PlaywrightGotoOptions } from './playwright-crawler.js';
|
|
11
|
+
import type { PlaywrightCrawlerOptions, PlaywrightCrawlingContext, PlaywrightGotoOptions } from './playwright-crawler.js';
|
|
12
12
|
import { type IRenderingTypePredictor } from './utils/rendering-type-prediction.js';
|
|
13
13
|
declare const adaptiveStatisticStateSchema: z.ZodObject<{
|
|
14
14
|
httpOnlyRequestHandlerRuns: z.ZodDefault<z.ZodNumber>;
|
|
@@ -91,7 +91,7 @@ type AdaptiveHook<ContextExtension = Dictionary<never>> = BrowserHook<AdaptiveHo
|
|
|
91
91
|
type AdaptivePostNavigationHook<ContextExtension = Dictionary<never>> = BrowserHook<Omit<AdaptiveHookContext, 'request'> & {
|
|
92
92
|
request: LoadedRequest<Request>;
|
|
93
93
|
}, ContextExtension>;
|
|
94
|
-
export interface AdaptivePlaywrightCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<AdaptivePlaywrightCrawlerContext['request']>>, StatisticStateExtension extends AdaptivePlaywrightCrawlerStatisticState = AdaptivePlaywrightCrawlerStatisticState> extends Omit<BasicCrawlerOptions<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension>, 'preNavigationHooks' | 'postNavigationHooks'> {
|
|
94
|
+
export interface AdaptivePlaywrightCrawlerOptions<ContextExtension = Dictionary<never>, ExtendedContext extends AdaptivePlaywrightCrawlerContext = AdaptivePlaywrightCrawlerContext & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<AdaptivePlaywrightCrawlerContext['request']>>, StatisticStateExtension extends AdaptivePlaywrightCrawlerStatisticState = AdaptivePlaywrightCrawlerStatisticState> extends Omit<BasicCrawlerOptions<AdaptivePlaywrightCrawlerContext, ContextExtension, ExtendedContext, Routes, StatisticStateExtension>, 'preNavigationHooks' | 'postNavigationHooks'>, Pick<PlaywrightCrawlerOptions, 'launchContext' | 'headless' | 'browserPool' | 'remoteBrowser'> {
|
|
95
95
|
/**
|
|
96
96
|
* Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies.
|
|
97
97
|
* The function accepts a subset of the crawling context. If you attempt to access the `page` property during HTTP-only crawling,
|
|
@@ -78,7 +78,7 @@ export class AdaptivePlaywrightCrawler extends BasicCrawler {
|
|
|
78
78
|
#attemptWritePolicy;
|
|
79
79
|
#teardownHooks = [];
|
|
80
80
|
constructor(options = {}) {
|
|
81
|
-
const { requestHandler, renderingTypeDetectionRatio = 0.1, renderingTypePredictor, resultChecker, shouldPropagateError, resultComparator, statistics, requestHandlerTimeoutSecs = 60, errorHandler, failedRequestHandler, preNavigationHooks = [], postNavigationHooks = [], extendContext, contextPipelineBuilder, transactionalStorage, ...rest } = options;
|
|
81
|
+
const { requestHandler, renderingTypeDetectionRatio = 0.1, renderingTypePredictor, resultChecker, shouldPropagateError, resultComparator, statistics, requestHandlerTimeoutSecs = 60, errorHandler, failedRequestHandler, preNavigationHooks = [], postNavigationHooks = [], extendContext, contextPipelineBuilder, transactionalStorage, launchContext, headless, browserPool, remoteBrowser, ...rest } = options;
|
|
82
82
|
// The user's value is replaced by `false` in the `super` call below — validate it separately,
|
|
83
83
|
// wrapped in an object so the error still names the field.
|
|
84
84
|
parseArgument({ transactionalStorage }, z.object({ transactionalStorage: BasicCrawler.optionsShape.transactionalStorage }), 'AdaptivePlaywrightCrawlerOptions');
|
|
@@ -166,6 +166,10 @@ export class AdaptivePlaywrightCrawler extends BasicCrawler {
|
|
|
166
166
|
preNavigationHooks: preNavigationHooks,
|
|
167
167
|
postNavigationHooks: postNavigationHooks,
|
|
168
168
|
extendContext,
|
|
169
|
+
launchContext,
|
|
170
|
+
headless,
|
|
171
|
+
browserPool,
|
|
172
|
+
remoteBrowser,
|
|
169
173
|
});
|
|
170
174
|
this.#teardownHooks.push(browserCrawler.teardown.bind(browserCrawler));
|
|
171
175
|
this.#staticContextPipeline = staticCrawler.contextPipeline.compose({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/playwright",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.153",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@apify/datastructures": "^2.0.3",
|
|
51
51
|
"@apify/timeout": "^0.4.4",
|
|
52
|
-
"@crawlee/basic": "4.0.0-beta.
|
|
53
|
-
"@crawlee/browser": "4.0.0-beta.
|
|
54
|
-
"@crawlee/browser-pool": "4.0.0-beta.
|
|
55
|
-
"@crawlee/cheerio": "4.0.0-beta.
|
|
56
|
-
"@crawlee/core": "4.0.0-beta.
|
|
57
|
-
"@crawlee/types": "4.0.0-beta.
|
|
58
|
-
"@crawlee/utils": "4.0.0-beta.
|
|
52
|
+
"@crawlee/basic": "4.0.0-beta.153",
|
|
53
|
+
"@crawlee/browser": "4.0.0-beta.153",
|
|
54
|
+
"@crawlee/browser-pool": "4.0.0-beta.153",
|
|
55
|
+
"@crawlee/cheerio": "4.0.0-beta.153",
|
|
56
|
+
"@crawlee/core": "4.0.0-beta.153",
|
|
57
|
+
"@crawlee/types": "4.0.0-beta.153",
|
|
58
|
+
"@crawlee/utils": "4.0.0-beta.153",
|
|
59
59
|
"cheerio": "^1.0.0",
|
|
60
60
|
"jquery": "^3.7.1",
|
|
61
61
|
"ml-logistic-regression": "^2.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "ed8a71673d628a52574d82e30f098cad1fe7a451"
|
|
84
84
|
}
|