@crawlee/browser-pool
Advanced tools
Comparing version 3.0.0-beta.39 to 3.0.0-beta.40
@@ -21,7 +21,7 @@ import { TypedEmitter } from 'tiny-typed-emitter'; | ||
*/ | ||
useFingerprintPerProxyCache?: boolean; | ||
useFingerprintCache?: boolean; | ||
/** | ||
* @default 10000 | ||
*/ | ||
fingerprintPerProxyCacheSize?: number; | ||
fingerprintCacheSize?: number; | ||
} | ||
@@ -28,0 +28,0 @@ export interface BrowserPoolOptions<Plugin extends BrowserPlugin = BrowserPlugin> { |
@@ -557,7 +557,7 @@ "use strict"; | ||
_initializeFingerprinting() { | ||
const { useFingerprintPerProxyCache = true, fingerprintPerProxyCacheSize = 10000 } = this.fingerprintsOptions; | ||
const { useFingerprintCache = true, fingerprintCacheSize = 10000 } = this.fingerprintsOptions; | ||
this.fingerprintGenerator = new fingerprint_generator_1.FingerprintGenerator(this.fingerprintsOptions.fingerprintGeneratorOptions); | ||
this.fingerprintInjector = new fingerprint_injector_1.FingerprintInjector(); | ||
if (useFingerprintPerProxyCache) { | ||
this.fingerprintCache = new quick_lru_1.default({ maxSize: fingerprintPerProxyCacheSize }); | ||
if (useFingerprintCache) { | ||
this.fingerprintCache = new quick_lru_1.default({ maxSize: fingerprintCacheSize }); | ||
} | ||
@@ -564,0 +564,0 @@ this._addFingerprintHooks(); |
@@ -12,4 +12,5 @@ "use strict"; | ||
return (_pageId, launchContext) => { | ||
const { useIncognitoPages, proxyUrl } = launchContext; | ||
const { useIncognitoPages } = launchContext; | ||
// @TODO: Fix the typings so they are easier to work with. | ||
const cacheKey = launchContext.session?.id ?? launchContext.proxyUrl; | ||
const { launchOptions } = launchContext; | ||
@@ -19,8 +20,8 @@ // If no options are passed we try to pass best default options as possible to match browser and OS. | ||
let fingerprint; | ||
if (proxyUrl && fingerprintCache?.has(proxyUrl)) { | ||
fingerprint = fingerprintCache.get(proxyUrl); | ||
if (cacheKey && fingerprintCache?.has(cacheKey)) { | ||
fingerprint = fingerprintCache.get(cacheKey); | ||
} | ||
else if (proxyUrl) { | ||
else if (cacheKey) { | ||
fingerprint = fingerprintGenerator.getFingerprint(fingerprintGeneratorFinalOptions); | ||
fingerprintCache?.set(proxyUrl, fingerprint); | ||
fingerprintCache?.set(cacheKey, fingerprint); | ||
} | ||
@@ -27,0 +28,0 @@ else { |
{ | ||
"name": "@crawlee/browser-pool", | ||
"version": "3.0.0-beta.39", | ||
"version": "3.0.0-beta.40", | ||
"description": "Rotate multiple browsers using popular automation libraries such as Playwright or Puppeteer.", | ||
@@ -5,0 +5,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
266764
2761