diff options
Diffstat (limited to 'module/plugins/hooks/LinkdecrypterCom.py')
-rw-r--r-- | module/plugins/hooks/LinkdecrypterCom.py | 64 |
1 files changed, 13 insertions, 51 deletions
diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index b0ce335d0..8592efd3d 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -2,64 +2,26 @@ import re -from module.network.RequestFactory import getURL -from module.plugins.Hook import Hook -from module.utils import remove_chars +from module.plugins.internal.MultiHook import MultiHook -class LinkdecrypterCom(Hook): +class LinkdecrypterCom(MultiHook): __name__ = "LinkdecrypterCom" __type__ = "hook" - __version__ = "0.21" + __version__ = "1.00" + + __config__ = [("mode" , "all;listed;unlisted", "Use for crypters (if supported)" , "all"), + ("pluginlist" , "str" , "Crypter list (comma separated)" , "" ), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] __description__ = """Linkdecrypter.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def coreReady(self): + def getCrypters(self): try: - self.loadPatterns() - except Exception, e: - self.logError(e) - - - def loadPatterns(self): - html = getURL("http://linkdecrypter.com/") - - m = re.search(r'<title>', html) - if m is None: - self.logError(_("Linkdecrypter site is down")) - return - - m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', html) - 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("Loaded pattern: %s" % regexp) + html = self.getURL("http://linkdecrypter.com/") + return re.search(r'>Supported\(\d+\)</b>: <i>(.+?) \+ RSDF', html).group(1).split(', ') + except Exception: + return list() |