diff options
Diffstat (limited to 'pyload/plugin/captcha/ReCaptcha.py')
-rw-r--r-- | pyload/plugin/captcha/ReCaptcha.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/pyload/plugin/captcha/ReCaptcha.py b/pyload/plugin/captcha/ReCaptcha.py index 4f35ed30b..410cb19de 100644 --- a/pyload/plugin/captcha/ReCaptcha.py +++ b/pyload/plugin/captcha/ReCaptcha.py @@ -18,14 +18,12 @@ class ReCaptcha(Captcha): __description = """ReCaptcha captcha service plugin""" __license = "GPLv3" __authors = [("pyLoad Team", "admin@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("zapp-brannigan", "fuerst.reinje@web.de")] - + ("Walter Purcaro", "vuolter@gmail.com"), + ("zapp-brannigan", "fuerst.reinje@web.de")] KEY_V2_PATTERN = r'(?:data-sitekey=["\']|["\']sitekey["\']:\s*["\'])([\w-]+)' KEY_V1_PATTERN = r'(?:recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=|Recaptcha\.create\s*\(\s*["\'])([\w-]+)' - def detect_key(self, html=None): if not html: if hasattr(self.plugin, "html") and self.plugin.html: @@ -44,7 +42,6 @@ class ReCaptcha(Captcha): self.logDebug("Key not found") return None - def challenge(self, key=None, html=None, version=None): if not key: if self.detect_key(html): @@ -66,7 +63,6 @@ class ReCaptcha(Captcha): self.plugin.fail(errmsg) raise TypeError(errmsg) - def _challenge_v1(self, key): html = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key}) @@ -83,7 +79,6 @@ class ReCaptcha(Captcha): return self.result(server, challenge), challenge - def result(self, server, challenge): result = self.plugin.decryptCaptcha("%simage" % server, get={'c': challenge}, @@ -95,13 +90,12 @@ class ReCaptcha(Captcha): return result - def _collectApiInfo(self): html = self.plugin.req.load("http://www.google.com/recaptcha/api.js") a = re.search(r'po.src = \'(.*?)\';', html).group(1) vers = a.split("/")[5] - self.logDebug("API version: %s" %vers) + self.logDebug("API version: %s" % vers) language = a.split("__")[1].split(".")[0] @@ -115,7 +109,6 @@ class ReCaptcha(Captcha): return vers, language, jsh - def _prepareTimeAndRpc(self): self.plugin.req.load("http://www.google.com/recaptcha/api2/demo") @@ -131,7 +124,6 @@ class ReCaptcha(Captcha): return millis, rpc - def _challenge_v2(self, key, parent=None): if parent is None: try: @@ -183,7 +175,7 @@ class ReCaptcha(Captcha): millis_captcha_loading = int(round(time.time() * 1000)) captcha_response = self.plugin.decryptCaptcha("https://www.google.com/recaptcha/api2/payload", - get={'c':token4.group(1), 'k':key}, + get={'c': token4.group(1), 'k': key}, cookies=True, forceUser=True) response = b64encode('{"response":"%s"}' % captcha_response) |