summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/base')
-rw-r--r--pyload/plugins/base/Addon.py5
-rw-r--r--pyload/plugins/base/Captcha.py67
2 files changed, 6 insertions, 66 deletions
diff --git a/pyload/plugins/base/Addon.py b/pyload/plugins/base/Addon.py
index 3cc152666..2dfeba83c 100644
--- a/pyload/plugins/base/Addon.py
+++ b/pyload/plugins/base/Addon.py
@@ -31,8 +31,9 @@ class Addon(Base):
__config__ = [("name", "type", "desc", "default")]
__description__ = """Interface for addon"""
- __author_name__ = ("mkaay", "RaNaN")
- __author_mail__ = ("mkaay@mkaay.de", "RaNaN@pyload.org")
+ __authors__ = [("mkaay", "mkaay@mkaay.de"),
+ ("RaNaN", "RaNaN@pyload.org")]
+
#: automatically register event listeners for functions, attribute will be deleted dont use it yourself
event_map = None
diff --git a/pyload/plugins/base/Captcha.py b/pyload/plugins/base/Captcha.py
index 4aafedd5f..86b073710 100644
--- a/pyload/plugins/base/Captcha.py
+++ b/pyload/plugins/base/Captcha.py
@@ -10,13 +10,13 @@ class Captcha(Plugin):
__version__ = "0.09"
__description__ = """Base captcha service plugin"""
- __author_name__ = "pyLoad Team"
- __author_mail__ = "admin@pyload.org"
+ __authors__ = [("pyLoad Team", "admin@pyload.org")]
- KEY_PATTERN = None
key = None
+ KEY_PATTERN = None
+
def __init__(self, plugin):
self.plugin = plugin
@@ -47,64 +47,3 @@ class Captcha(Plugin):
def result(self, server, challenge):
raise NotImplementedError
-
-
-class ReCaptcha(CaptchaService):
- __name__ = "ReCaptcha"
- __version__ = "0.02"
-
- __description__ = """ReCaptcha captcha service plugin"""
- __author_name__ = "pyLoad Team"
- __author_mail__ = "admin@pyload.org"
-
-
- KEY_PATTERN = r"https?://(?:www\.)?google\.com/recaptcha/api/challenge\?k=(?P<KEY>\w+?)"
- KEY_AJAX_PATTERN = r"Recaptcha\.create\s*\(\s*[\"'](?P<KEY>\w+)[\"']\s*,"
-
-
- def detect_key(self, html=None):
- if not html:
- if hasattr(self.plugin, "html") and self.plugin.html:
- html = self.plugin.html
- else:
- errmsg = "ReCaptcha html missing"
- self.plugin.fail(errmsg)
- raise TypeError(errmsg)
-
- m = re.search(self.KEY_PATTERN, html)
- if m is None:
- m = re.search(self.KEY_AJAX_PATTERN, html)
- if m:
- self.key = m.group("KEY")
- self.plugin.logDebug("ReCaptcha key: %s" % self.key)
- return self.key
- else:
- self.plugin.logDebug("ReCaptcha key not found")
- return None
-
-
- def challenge(self, key=None):
- if not key:
- if self.key:
- key = self.key
- else:
- errmsg = "ReCaptcha key missing"
- self.plugin.fail(errmsg)
- raise TypeError(errmsg)
-
- js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key}, cookies=True)
-
- try:
- challenge = re.search("challenge : '(.+?)',", js).group(1)
- server = re.search("server : '(.+?)',", js).group(1)
- except:
- self.plugin.parseError("ReCaptcha challenge pattern not found")
-
- result = self.result(server, challenge)
-
- return challenge, result
-
-
- def result(self, server, challenge):
- return self.plugin.decryptCaptcha("%simage" % server, get={'c': challenge},
- cookies=True, forceUser=True, imgtype="jpg")