diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-05 03:32:15 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-05 03:32:15 +0200 |
commit | 684f265d1463d5def302decb1172e9b9b7381cb4 (patch) | |
tree | db3d0a5285b9fdbdab51827cb76e26c53a2ffaf1 /pyload/plugins/hook/LinkdecrypterCom.py | |
parent | Split CaptchaService to captcha directory (diff) | |
download | pyload-684f265d1463d5def302decb1172e9b9b7381cb4.tar.xz |
Move hooks to hook directory
Diffstat (limited to 'pyload/plugins/hook/LinkdecrypterCom.py')
-rw-r--r-- | pyload/plugins/hook/LinkdecrypterCom.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/pyload/plugins/hook/LinkdecrypterCom.py b/pyload/plugins/hook/LinkdecrypterCom.py new file mode 100644 index 000000000..6c59ee5c6 --- /dev/null +++ b/pyload/plugins/hook/LinkdecrypterCom.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.network.RequestFactory import getURL +from pyload.plugins.base.Addon import Addon +from pyload.utils import remove_chars + + +class LinkdecrypterCom(Addon): + __name__ = "LinkdecrypterCom" + __type__ = "addon" + __version__ = "0.19" + + __config__ = [("activated", "bool", "Activated", False)] + + __description__ = """Linkdecrypter.com addon plugin""" + __author_name__ = "zoidberg" + __author_mail__ = "zoidberg@mujmail.cz" + + + def coreReady(self): + try: + self.loadPatterns() + except Exception, e: + self.logError(e) + + def loadPatterns(self): + page = getURL("http://linkdecrypter.com/") + m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', page) + if m is None: + self.logError(_("Crypter list not found")) + return + + builtin = [name.lower() for name in self.core.pluginManager.crypterPlugins.keys()] + builtin.append("downloadserienjunkiesorg") + + crypter_pattern = re.compile("(\w[\w.-]+)") + online = [] + for crypter in m.group(1).split(', '): + m = re.match(crypter_pattern, crypter) + if m and remove_chars(m.group(1), "-.") not in builtin: + online.append(m.group(1).replace(".", "\\.")) + + if not online: + self.logError(_("Crypter list is empty")) + return + + regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online) + + dict = self.core.pluginManager.crypterPlugins[self.__name__] + dict['pattern'] = regexp + dict['re'] = re.compile(regexp) + + self.logDebug("REGEXP", regexp) |