summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/LinkdecrypterCom.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-01-30 18:17:43 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-01-30 18:17:43 +0100
commit2f31e623d7d3aab497533c4fd1cc8d0260419c57 (patch)
tree803f87aef00bd49e61edeb654f36dbedc297788d /module/plugins/hooks/LinkdecrypterCom.py
parentincrease version (diff)
downloadpyload-2f31e623d7d3aab497533c4fd1cc8d0260419c57.tar.xz
closed #517, #520
Diffstat (limited to 'module/plugins/hooks/LinkdecrypterCom.py')
-rw-r--r--module/plugins/hooks/LinkdecrypterCom.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py
new file mode 100644
index 000000000..5acdbddcb
--- /dev/null
+++ b/module/plugins/hooks/LinkdecrypterCom.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from module.plugins.Hook import Hook
+from module.network.RequestFactory import getURL
+from module.utils import remove_chars
+
+class LinkdecrypterCom(Hook):
+ __name__ = "LinkdecrypterCom"
+ __version__ = "0.1"
+ __description__ = """linkdecrypter.com - regexp loader"""
+ __config__ = [ ("activated", "bool", "Activated" , "True") ]
+ __author_name__ = ("zoidberg")
+
+ def coreReady(self):
+ page = getURL("http://linkdecrypter.com/")
+ m = re.search(r'<b>Supported</b>: <i>([^+<]*)', page)
+ if not m:
+ self.logError(_("Crypter list not found"))
+ return
+
+ online = m.group(1).split(', ')
+ builtin = [ name.lower() for name in self.core.pluginManager.crypterPlugins.keys() ]
+ online = [ crypter.replace(".", "\\.") for crypter in online if remove_chars(crypter, "-.") not in builtin ]
+ if not online:
+ self.logError(_("Crypter list is empty"))
+ return
+
+ regexp = r"http://[\w.]*?(%s).*" % "|".join(online)
+
+ dict = self.core.pluginManager.crypterPlugins[self.__name__]
+ dict["pattern"] = regexp
+ dict["re"] = re.compile(regexp)
+
+ self.logDebug("REGEXP: " + regexp) \ No newline at end of file