From 8854ce97bba7858dfc9385530e0c090200944ede Mon Sep 17 00:00:00 2001 From: david Date: Wed, 26 May 2021 23:27:20 +0200 Subject: [PATCH] fix: clear cookies when rotating proxies (#2575) --- src/store/lookup.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/store/lookup.ts b/src/store/lookup.ts index 1e141ae4e8..c2a5f691e1 100644 --- a/src/store/lookup.ts +++ b/src/store/lookup.ts @@ -280,6 +280,15 @@ async function lookup(browser: Browser, store: Store) { await disableBlockerInPage(pageProxy); } + if ( + store.currentProxyIndex !== undefined && + store.proxyList && + store.proxyList?.length > 1 + ) { + const client = await page.target().createCDPSession(); + await client.send('Network.clearBrowserCookies'); + } + // Must apply backoff before closing the page, e.g. if CloudFlare is // used to detect bot traffic, it introduces a 5 second page delay // before redirecting to the next page