diff options
Diffstat (limited to 'pyload/plugins/ReCaptcha.py')
-rw-r--r-- | pyload/plugins/ReCaptcha.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pyload/plugins/ReCaptcha.py b/pyload/plugins/ReCaptcha.py new file mode 100644 index 000000000..e47522b4a --- /dev/null +++ b/pyload/plugins/ReCaptcha.py @@ -0,0 +1,22 @@ +import re + +class ReCaptcha(): + def __init__(self, plugin): + self.plugin = plugin + self.plugin.logDebug("Deprecated usage of ReCaptcha: Use CaptchaService instead") + + def challenge(self, id): + js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={"k":id}, cookies=True) + + try: + challenge = re.search("challenge : '(.*?)',", js).group(1) + server = re.search("server : '(.*?)',", js).group(1) + except: + self.plugin.fail("recaptcha error") + result = self.result(server,challenge) + + return challenge, result + + def result(self, server, challenge): + return self.plugin.decryptCaptcha("%simage"%server, get={"c":challenge}, cookies=True, imgtype="jpg") + |