Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to crack a Tencent Captcha #118

Open
gabriellopesdesouza2002 opened this issue Dec 13, 2024 · 1 comment
Open

Error trying to crack a Tencent Captcha #118

gabriellopesdesouza2002 opened this issue Dec 13, 2024 · 1 comment

Comments

@gabriellopesdesouza2002

Hello!

I'm running the code below to break a Tencent captcha, but every time I run it, it sends me this except: ApiException('ERROR_CAPTCHA_UNSOLVABLE')
I've checked the site's code internally, and the data I send to the API is correct, the site in question is “https://consultapublicapje.tjba.jus.br/pje/ConsultaPublica/listView.seam”.

I'm using

  • Python 3.11.9
  • Google Chrome 131.0.6778.140

Under the following libraries with the versions

  • 2captcha-python==1.5.0
  • requests==2.32.3
  • selenium==4.26.1
  • urllib3==2.2.3

Below is also an image of the site's source code, which has Tencent's appid.

Please help me with this!

            def captcha_break():
                self.DRIVER.find_element(By.ID,'fPP:searchProcessos').click()
                sleep(5)
                def _solver():
                    solver = TwoCaptcha(self.CAPTCHA_KEY)
                    result = solver.tencent(app_id=189956587, url=URL)
                    if isinstance(result['captchaId'], str):
                        return_code = json.loads(result['code'])
                        return {
                            'captchaId': result['captchaId'],
                            'ticket': return_code['ticket'],
                            'randstr': return_code['randstr'],
                        }
                    else:
                        return False
                
                attempts = 5
                while attempts > 0:
                    try:
                        self.DRIVER.execute_script('executarTencentCaptcha()')
                        result_captcha = _solver()
                        if not result_captcha:
                            continue
                        break
                    except Exception as e:
                        print(repr(e))
                        attempts -= 1
                if attempts == 0:
                    print('The captcha could not be broken', in_panel=True)
                    return
                script = f"""
const resp = {{
    ret: 0,
    randstr: "{result_captcha['randstr']}",
    ticket: "{result_captcha['ticket']}"
}};
onSubmitTencentCaptcha(resp)"""
                self.DRIVER.execute_script(script)

image

@dzmitry-duboyski
Copy link
Contributor

dzmitry-duboyski commented Dec 25, 2024

@gabriellopesdesouza2002 hello.
Try send a captcha using the proxy parameter. Using proxy your location, it should help in your case.

If this does not solve your problem, then please create a ticket https://2captcha.com/support/tickets/new.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants