summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/captcha
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugin/captcha')
-rw-r--r--pyload/plugin/captcha/AdYouLike.py3
-rw-r--r--pyload/plugin/captcha/ReCaptcha.py7
2 files changed, 10 insertions, 0 deletions
diff --git a/pyload/plugin/captcha/AdYouLike.py b/pyload/plugin/captcha/AdYouLike.py
index 83fc4e1a3..a29524bcc 100644
--- a/pyload/plugin/captcha/AdYouLike.py
+++ b/pyload/plugin/captcha/AdYouLike.py
@@ -18,6 +18,7 @@ class AdYouLike(Captcha):
AYL_PATTERN = r'Adyoulike\.create\s*\((.+?)\)'
CALLBACK_PATTERN = r'(Adyoulike\.g\._jsonp_\d+)'
+
def detect_key(self, html=None):
if not html:
if hasattr(self.plugin, "html") and self.plugin.html:
@@ -37,6 +38,7 @@ class AdYouLike(Captcha):
self.logDebug("Ayl or callback not found")
return None
+
def challenge(self, key=None, html=None):
if not key:
if self.detect_key(html):
@@ -68,6 +70,7 @@ class AdYouLike(Captcha):
return self.result(ayl, challenge), challenge
+
def result(self, server, challenge):
# Adyoulike.g._jsonp_5579316662423138
# ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},
diff --git a/pyload/plugin/captcha/ReCaptcha.py b/pyload/plugin/captcha/ReCaptcha.py
index 004a86bf9..9c75c2212 100644
--- a/pyload/plugin/captcha/ReCaptcha.py
+++ b/pyload/plugin/captcha/ReCaptcha.py
@@ -24,6 +24,7 @@ class ReCaptcha(Captcha):
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:
@@ -42,6 +43,7 @@ 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):
@@ -63,6 +65,7 @@ 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})
@@ -79,6 +82,7 @@ class ReCaptcha(Captcha):
return self.result(server, challenge), challenge
+
def result(self, server, challenge):
result = self.plugin.decryptCaptcha("%simage" % server,
get={'c': challenge},
@@ -90,6 +94,7 @@ 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)
@@ -109,6 +114,7 @@ class ReCaptcha(Captcha):
return vers, language, jsh
+
def _prepareTimeAndRpc(self):
self.plugin.req.load("http://www.google.com/recaptcha/api2/demo")
@@ -124,6 +130,7 @@ class ReCaptcha(Captcha):
return millis, rpc
+
def _challenge_v2(self, key, parent=None):
if parent is None:
try: