Open
Description
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)
Metadata
Metadata
Assignees
Labels
No labels