Commit d44a23d4 authored by Florian Duguet's avatar Florian Duguet Committed by Vincent A

[anticaptcha] Handle Hcaptcha

parent 6aad2796
......@@ -24,8 +24,8 @@ from base64 import b64encode
from weboob.browser.browsers import APIBrowser
from weboob.exceptions import BrowserIncorrectPassword, BrowserBanned
from weboob.capabilities.captcha import (
ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob, CaptchaError,
InsufficientFunds, UnsolvableCaptcha, InvalidCaptcha,
ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob, HcaptchaJob,
CaptchaError, InsufficientFunds, UnsolvableCaptcha, InvalidCaptcha,
)
......@@ -61,6 +61,9 @@ class AnticaptchaBrowser(APIBrowser):
def post_nocaptcha(self, url, key):
return self.post_gcaptcha(url, key, 'NoCaptcha')
def post_hcaptcha(self, url, key):
return self.post_gcaptcha(url, key, 'HCaptcha')
def post_gcaptcha(self, url, key, prefix):
data = {
"clientKey": self.apikey,
......@@ -147,7 +150,7 @@ class AnticaptchaBrowser(APIBrowser):
elif isinstance(job, RecaptchaJob):
job.solution = sol['recaptchaResponse']
job.solution_challenge = sol['recaptchaChallenge']
elif isinstance(job, NocaptchaJob) or isinstance(job, RecaptchaV3Job):
elif isinstance(job, (NocaptchaJob, RecaptchaV3Job, HcaptchaJob)):
job.solution = sol['gRecaptchaResponse']
elif isinstance(job, FuncaptchaJob):
job.solution = sol['token']
......
......@@ -22,7 +22,8 @@ from __future__ import unicode_literals
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.captcha import (
CapCaptchaSolver, ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob
CapCaptchaSolver, ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob,
HcaptchaJob,
)
from weboob.tools.value import ValueBackendPassword
......@@ -61,6 +62,8 @@ class AnticaptchaModule(Module, CapCaptchaSolver):
job.id = self.browser.post_nocaptcha(job.site_url, job.site_key)
elif isinstance(job, FuncaptchaJob):
job.id = self.browser.post_funcaptcha(job.site_url, job.site_key, job.sub_domain)
elif isinstance(job, HcaptchaJob):
job.id = self.browser.post_hcaptcha(job.site_url, job.site_key)
else:
raise NotImplementedError()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment