diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-26 19:09:47 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-26 19:09:47 +0200 |
commit | 0c2c1f9e7c514a77fdb04329322fab2ed601df01 (patch) | |
tree | d1f2b34abf900047f6da0b5e7e9a7ede46c4a2f0 | |
parent | Rename SH flags (diff) | |
download | pyload-0c2c1f9e7c514a77fdb04329322fab2ed601df01.tar.xz |
[CaptchaService] Fix ReCaptcha key recognition
Fix: https://github.com/pyload/pyload/issues/751
-rw-r--r-- | module/plugins/internal/CaptchaService.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index b247ba654..26482379d 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -7,7 +7,7 @@ from random import random class CaptchaService: __name__ = "CaptchaService" - __version__ = "0.05" + __version__ = "0.06" __description__ = """Captcha service plugin""" __author_name__ = "pyLoad Team" @@ -28,6 +28,7 @@ class ReCaptcha: def __init__(self, plugin): self.plugin = plugin + def detect_key(self, html): m = re.search(self.RECAPTCHA_KEY_PATTERN, html) if m is None: @@ -38,11 +39,13 @@ class ReCaptcha: else: return None + def challenge(self, key=None): - if key is None and self.recaptcha_key: - key = self.recaptcha_key - else: - raise TypeError("ReCaptcha key not found") + if not key: + if self.recaptcha_key: + key = self.recaptcha_key + else: + raise TypeError("ReCaptcha key not found") js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={"k": key}, cookies=True) @@ -55,6 +58,7 @@ class ReCaptcha: return challenge, result + def result(self, server, challenge): return self.plugin.decryptCaptcha("%simage" % server, get={"c": challenge}, cookies=True, forceUser=True, imgtype="jpg") @@ -74,6 +78,7 @@ class AdsCaptcha(CaptchaService): return challenge, result + def result(self, server, challenge): return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={"cid": challenge, "dummy": random()}, cookies=True, imgtype="jpg") @@ -92,5 +97,6 @@ class SolveMedia(CaptchaService): return challenge, result + def result(self, challenge): return self.plugin.decryptCaptcha("http://api.solvemedia.com/papi/media?c=%s" % challenge, imgtype="gif") |