vvanglro / cf-clearance

Purpose To make a cloudflare v2 challenge pass successfully, Can be use cf_clearance bypassed by cloudflare, However, with the cf_clearance, make sure you use the same IP and UA as when you got it.
https://github.com/vvanglro/cf_clearance
355 stars 59 forks source link

playwright._impl._api_types.Error: net::ERR_PROXY_CONNECTION_FAILED #3

Closed Bexa2 closed 2 years ago

Bexa2 commented 2 years ago

Hi, I'm getting that error.

I'm not sure, why is the proxy necessary?

Bexa2 commented 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.

vvanglro commented 2 years ago

It is only suggested to use proxy access, can you send out the URL you visit, I will try

vvanglro commented 2 years ago

Frequent access without a proxy makes the challenge difficult to pass, and graphical captcha appears