summaryrefslogtreecommitdiffstats
path: root/module/plugins/ReCaptcha.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-29 22:42:20 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-29 22:42:20 +0100
commit265c1a0711e5e50b8507ba35253f2dc55e01f88e (patch)
treeeb67565d511b3b6c84160d27be2f24a590b24a03 /module/plugins/ReCaptcha.py
parentclient side settings save, working dl button on dashboard (diff)
downloadpyload-265c1a0711e5e50b8507ba35253f2dc55e01f88e.tar.xz
fix in update file info, moved recaptcha back
Diffstat (limited to 'module/plugins/ReCaptcha.py')
-rw-r--r--module/plugins/ReCaptcha.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/module/plugins/ReCaptcha.py b/module/plugins/ReCaptcha.py
new file mode 100644
index 000000000..e47522b4a
--- /dev/null
+++ b/module/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")
+