summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/CaptchaService.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-21 22:53:37 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-21 22:53:37 +0200
commit027cb529d79558de19c47da88a782b31745a65c9 (patch)
tree18ab9a8568cee2d07e6fc0dc8f9c03202245c594 /module/plugins/internal/CaptchaService.py
parentNew __status__ magic key (diff)
downloadpyload-027cb529d79558de19c47da88a782b31745a65c9.tar.xz
New Captcha skeleton
Diffstat (limited to 'module/plugins/internal/CaptchaService.py')
-rw-r--r--module/plugins/internal/CaptchaService.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py
new file mode 100644
index 000000000..05af8ccec
--- /dev/null
+++ b/module/plugins/internal/CaptchaService.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.Plugin import Plugin
+
+
+class Captcha(Plugin):
+ __name__ = "Captcha"
+ __type__ = "captcha"
+ __version__ = "0.31"
+ __status__ = "stable"
+
+ __description__ = """Base anti-captcha service plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+
+
+ def init(self):
+ self.key = None #: Last key detected
+
+
+ #@TODO: Recheck in 0.4.10
+ def retrieve_key(self, data):
+ if self.detect_key(data):
+ return self.key
+ else:
+ self.fail(_("%s key not found") % self.__name__)
+
+
+ #@TODO: Recheck in 0.4.10, html is now pyfile.data
+ def retrieve_data(self):
+ if hasattr(self.plugin, "html") and self.plugin.html:
+ return self.plugin.html
+ else:
+ self.fail(_("%s data not found") % self.__name__)
+
+
+ def detect_key(self, data=None):
+ raise NotImplementedError
+
+
+ def challenge(self, key=None, data=None):
+ raise NotImplementedError
+
+
+ def result(self, server, challenge):
+ raise NotImplementedError