diff --git a/modules/anticaptcha/browser.py b/modules/anticaptcha/browser.py index ce8c8a238b3c30121f53a0b2f18d70d21238b558..14a462d98e3a5ca500fc8e5720da94b143a9a98d 100644 --- a/modules/anticaptcha/browser.py +++ b/modules/anticaptcha/browser.py @@ -24,7 +24,7 @@ from weboob.browser.browsers import APIBrowser from weboob.exceptions import BrowserIncorrectPassword, BrowserBanned from weboob.capabilities.captcha import ( - ImageCaptchaJob, RecaptchaJob, NocaptchaJob, FuncaptchaJob, CaptchaError, + ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob, CaptchaError, InsufficientFunds, UnsolvableCaptcha, InvalidCaptcha, ) @@ -74,6 +74,20 @@ def post_gcaptcha(self, url, key, prefix): r = self.request('/createTask', data=data) return str(r['taskId']) + def post_gcaptchav3(self, url, key, action): + data = { + "clientKey": self.apikey, + "task":{ + "type":"RecaptchaV3TaskProxyless", + "websiteURL": url, + "websiteKey": key, + "minScore": 0.3, + "pageAction": action + } + } + r = self.request('/createTask', data=data) + return str(r['taskId']) + def post_funcaptcha(self, url, key, sub_domain): data = { "clientKey": self.apikey, @@ -128,7 +142,7 @@ def poll(self, job): elif isinstance(job, RecaptchaJob): job.solution = sol['recaptchaResponse'] job.solution_challenge = sol['recaptchaChallenge'] - elif isinstance(job, NocaptchaJob): + elif isinstance(job, NocaptchaJob) or isinstance(job, RecaptchaV3Job): job.solution = sol['gRecaptchaResponse'] elif isinstance(job, FuncaptchaJob): job.solution = sol['token'] diff --git a/modules/anticaptcha/module.py b/modules/anticaptcha/module.py index c072fc65bf89e59de4c5522eaf87834d3b46fb9a..6d1674ca94d7f8855798523fce06b9063a9c7635 100644 --- a/modules/anticaptcha/module.py +++ b/modules/anticaptcha/module.py @@ -21,7 +21,9 @@ from weboob.tools.backend import Module, BackendConfig -from weboob.capabilities.captcha import CapCaptchaSolver, ImageCaptchaJob, RecaptchaJob, NocaptchaJob, FuncaptchaJob +from weboob.capabilities.captcha import ( + CapCaptchaSolver, ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob +) from weboob.tools.value import ValueBackendPassword from .browser import AnticaptchaBrowser @@ -53,6 +55,8 @@ def create_job(self, job): job.id = self.browser.post_image(job.image) elif isinstance(job, RecaptchaJob): job.id = self.browser.post_recaptcha(job.site_url, job.site_key) + elif isinstance(job, RecaptchaV3Job): + job.id = self.browser.post_gcaptchav3(job.site_url, job.site_key, job.action) elif isinstance(job, NocaptchaJob): job.id = self.browser.post_nocaptcha(job.site_url, job.site_key) elif isinstance(job, FuncaptchaJob):