Comments (1)
Seems like a sign of a much larger underlying issue:
New sessions / fingerprints / proxyUrls are generated only on a browser launch.
The following snippet doesn't rotate the fingerprints correctly - all requests are done with one session only. This is because the useIncognitoPages
was written with Playwright contexts in mind - we relied on the "newPage()
creates a separate environment" invariant, so all the pages/contexts are launched in one browser.
sessionPoolOptions: {
sessionOptions: {
maxUsageCount: 1,
},
},
launchContext: {
useIncognitoPages: true,
},
The following snippet rotates the fingerprints correctly:
sessionPoolOptions: {
sessionOptions: {
maxUsageCount: 1,
},
},
launchContext: {
useIncognitoPages: false,
},
This works well because an "expired" session throws away the whole browser instance, causing the new pages to launch a whole new browser (see the parallel with the maxOpenPagesPerBrowser
, which does the same thing). This is crazy expensive though, while launching and closing a context 100 times in one browser takes ~3.9 seconds, launching and closing a browser 100 times takes 40 seconds.
The entire browser-pool
and session rotation logic is quite convoluted and worth a total rewrite.
from crawlee.
Related Issues (20)
- add "exclude" property to enqueueLinksByClickingElements like "enqueueLinks"
- Implement Automatic Memory Management in Playwright for Enhanced Stability in Web Crawling Operations
- Support plain-text sitemaps (sitemap.txt) in the `Sitemap` class HOT 1
- Implement sitemap autodetection (independent of robots.txt)
- `maxUsageCount: 1` does not retire session after a single use HOT 1
- Add support for all tags defined by the sitemap protocol
- `page.evaluate` results error HOT 2
- HttpCrawler - determining character encoding
- Add `waitForAllRequestsToBeAdded` option to `enqueueLinks`
- XPATH selectors support HOT 4
- Multiple calls to enqueueLinks with Promise.all result in a crash HOT 1
- `RestrictedCrawlingContext` should not extend `Record<string, unknown>` HOT 2
- Could not kill browser: Cannot read private member #process from an object whose class did not declare it HOT 2
- Image not available(build status) in readme
- page.waitForTimeout is removed
- `querySelector` should be propagated to all crawling contexts
- Write an e2e test of adaptive playwright crawler
- Adaptive crawling
- Initial PoC version of adaptive crawler
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crawlee.