Closed Bexa2 closed 2 years ago
I removed the proxies just to try but it seems to be not waiting for the page to load.
def solveCFchallenge(self) -> None:
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
page = browser.new_page()
stealth_sync(page)
page.goto(str(self.url))
res = sync_retry(page)
if res:
self.log.debug(res)
cookies = page.context.cookies()
for cookie in cookies:
if cookie.get('name') == 'cf_clearance':
self.s.cookies.update(cookie)
ua = page.evaluate('() => {return navigator.userAgent}')
self.s.headers["user-agent"] = ua
else:
self.log.error("Couldn't solve Cloudflare Challenge")
browser.close()
raise Exception("cf challenge fail")
browser.close()
def get(self, url, **kwargs):
res = self.s.get(url, **kwargs)
if '<title>Please Wait... | Cloudflare</title>' in res.text:
self.log.info("Trying to solve Cloudflare Challenge")
self.solveCFchallenge()
res = self.s.get(url, **kwargs)
return res
I don't even get an exception or an error log saying it failed the challenge, it seems to reach browser.close()
instantly.
It is only suggested to use proxy access, can you send out the URL you visit, I will try
Frequent access without a proxy makes the challenge difficult to pass, and graphical captcha appears
Hi, I'm getting that error.
I'm not sure, why is the proxy necessary?