aboutsummaryrefslogtreecommitdiffhomepage
path: root/libs/cloudscraper/captcha/capmonster.py
diff options
context:
space:
mode:
Diffstat (limited to 'libs/cloudscraper/captcha/capmonster.py')
-rw-r--r--libs/cloudscraper/captcha/capmonster.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/libs/cloudscraper/captcha/capmonster.py b/libs/cloudscraper/captcha/capmonster.py
index 5846b2df9..9e636106d 100644
--- a/libs/cloudscraper/captcha/capmonster.py
+++ b/libs/cloudscraper/captcha/capmonster.py
@@ -29,11 +29,6 @@ class captchaSolver(Captcha):
super(captchaSolver, self).__init__('capmonster')
self.host = 'https://api.capmonster.cloud'
self.session = requests.Session()
- self.captchaType = {
- 'reCaptcha': 'NoCaptchaTask',
- 'hCaptcha': 'HCaptchaTask',
- 'turnstile': 'TurnstileTask'
- }
# ------------------------------------------------------------------------------- #
@@ -84,11 +79,7 @@ class captchaSolver(Captcha):
)
if response:
- payload = response.json()['solution']
- if 'token' in payload:
- return payload['token']
- else:
- return payload['gRecaptchaResponse']
+ return response.json()['solution']['gRecaptchaResponse']
else:
raise CaptchaTimeout(
"CapMonster: Error failed to solve Captcha."
@@ -110,9 +101,9 @@ class captchaSolver(Captcha):
'task': {
'websiteURL': url,
'websiteKey': siteKey,
- 'type': self.captchaType[captchaType]
- },
- 'softId': 37
+ 'softId': 37,
+ 'type': 'NoCaptchaTask' if captchaType == 'reCaptcha' else 'HCaptchaTask'
+ }
}
if self.proxy: