@crawlee/playwright 4.0.0-beta.126 → 4.0.0-beta.128
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.
|
@@ -18,7 +18,7 @@ declare const adaptiveStatisticStateSchema: z.ZodObject<{
|
|
|
18
18
|
}, z.core.$strip>;
|
|
19
19
|
/**
|
|
20
20
|
* The extra statistics fields {@link AdaptivePlaywrightCrawler} tracks on top of the built-in
|
|
21
|
-
* {@link StatisticState} ones. They are available on `crawler.
|
|
21
|
+
* {@link StatisticState} ones. They are available on `crawler.statistics.state` and are persisted with the rest of
|
|
22
22
|
* the statistics.
|
|
23
23
|
*/
|
|
24
24
|
export type AdaptivePlaywrightCrawlerStatisticState = z.infer<typeof adaptiveStatisticStateSchema>;
|
|
@@ -322,7 +322,7 @@ export class AdaptivePlaywrightCrawler extends BasicCrawler {
|
|
|
322
322
|
try {
|
|
323
323
|
if (renderingTypePrediction.renderingType === 'static' && !shouldDetectRenderingType) {
|
|
324
324
|
crawlingContext.log.debug(`Running HTTP-only request handler for ${crawlingContext.request.url}`);
|
|
325
|
-
this.
|
|
325
|
+
this.statistics.state.httpOnlyRequestHandlerRuns++;
|
|
326
326
|
const plainHTTPRun = await this.crawlOne('static', crawlingContext, crawlingContext.useState, transactions);
|
|
327
327
|
if (plainHTTPRun.ok && this.#resultChecker(plainHTTPRun.result)) {
|
|
328
328
|
crawlingContext.log.debug(`HTTP-only request handler succeeded for ${crawlingContext.request.url}`);
|
|
@@ -342,11 +342,11 @@ export class AdaptivePlaywrightCrawler extends BasicCrawler {
|
|
|
342
342
|
}
|
|
343
343
|
else {
|
|
344
344
|
crawlingContext.log.warning(`HTTP-only request handler returned a suspicious result for ${crawlingContext.request.url}`);
|
|
345
|
-
this.
|
|
345
|
+
this.statistics.state.renderingTypeMispredictions++;
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
crawlingContext.log.debug(`Running browser request handler for ${crawlingContext.request.url}`);
|
|
349
|
-
this.
|
|
349
|
+
this.statistics.state.browserRequestHandlerRuns++;
|
|
350
350
|
// Run the request handler in a browser. The copy of the crawler state is kept so that we can perform
|
|
351
351
|
// a rendering type detection if necessary. Without this measure, the HTTP request handler would run
|
|
352
352
|
// under different conditions, which could change its behavior. Changes done to the crawler state by
|
|
@@ -499,9 +499,9 @@ async function handleCloudflareChallenge(page, url, options = {}) {
|
|
|
499
499
|
};
|
|
500
500
|
options.isChallengeCallback ??= async () => {
|
|
501
501
|
return await page.evaluate(async () => {
|
|
502
|
-
// Cloudflare
|
|
503
|
-
//
|
|
504
|
-
return !!document.querySelector('.footer .footer-inner .
|
|
502
|
+
// Cloudflare keeps reshuffling the wrapper elements between `.footer-inner` and `.ray-id`,
|
|
503
|
+
// so only the stable outer classes are matched.
|
|
504
|
+
return !!document.querySelector('.footer .footer-inner .ray-id');
|
|
505
505
|
});
|
|
506
506
|
};
|
|
507
507
|
const retryBlocked = async () => {
|
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.128",
|
|
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.128",
|
|
53
|
+
"@crawlee/browser": "4.0.0-beta.128",
|
|
54
|
+
"@crawlee/browser-pool": "4.0.0-beta.128",
|
|
55
|
+
"@crawlee/cheerio": "4.0.0-beta.128",
|
|
56
|
+
"@crawlee/core": "4.0.0-beta.128",
|
|
57
|
+
"@crawlee/types": "4.0.0-beta.128",
|
|
58
|
+
"@crawlee/utils": "4.0.0-beta.128",
|
|
59
59
|
"cheerio": "^1.0.0",
|
|
60
60
|
"jquery": "^3.7.1",
|
|
61
61
|
"ml-logistic-regression": "^2.0.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "2c017f04d564e8fa13855bf19f31f43cb65f4f44"
|
|
88
88
|
}
|