summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/LinkdecrypterCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 10:46:28 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 10:46:28 +0100
commitce1c2b6b05c08b669357947e61ae40efce7fc50f (patch)
tree0b5f7996960cf35c4eface53a89eba18a37519b7 /module/plugins/hooks/LinkdecrypterCom.py
parentFix filename case (diff)
downloadpyload-ce1c2b6b05c08b669357947e61ae40efce7fc50f.tar.xz
module temp
Diffstat (limited to 'module/plugins/hooks/LinkdecrypterCom.py')
-rw-r--r--module/plugins/hooks/LinkdecrypterCom.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py
new file mode 100644
index 000000000..fff596386
--- /dev/null
+++ b/module/plugins/hooks/LinkdecrypterCom.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from pyload.network.RequestFactory import getURL
+from pyload.plugin.Addon import Addon
+from pyload.utils import remove_chars
+
+
+class LinkdecrypterCom(Addon):
+ __name__ = "LinkdecrypterCom"
+ __type__ = "hook"
+ __version__ = "0.21"
+
+ __description__ = """Linkdecrypter.com hook plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
+
+
+ def activate(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)