diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 10:46:28 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 10:46:28 +0100 |
commit | ce1c2b6b05c08b669357947e61ae40efce7fc50f (patch) | |
tree | 0b5f7996960cf35c4eface53a89eba18a37519b7 /module/plugins/crypter/MultiloadCz.py | |
parent | Fix filename case (diff) | |
download | pyload-ce1c2b6b05c08b669357947e61ae40efce7fc50f.tar.xz |
module temp
Diffstat (limited to 'module/plugins/crypter/MultiloadCz.py')
-rw-r--r-- | module/plugins/crypter/MultiloadCz.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py new file mode 100644 index 000000000..4229caa6e --- /dev/null +++ b/module/plugins/crypter/MultiloadCz.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +import re +from pyload.plugin.Crypter import Crypter + + +class MultiloadCz(Crypter): + __name__ = "MultiloadCz" + __type__ = "crypter" + __version__ = "0.40" + + __pattern__ = r'http://(?:[^/]*\.)?multiload\.cz/(stahnout|slozka)/.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True), + ("usedHoster", "str", "Prefered hoster list (bar-separated)", ""), + ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] + + __description__ = """Multiload.cz decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + FOLDER_PATTERN = r'<form action="" method="get"><textarea[^>]*>([^>]*)</textarea></form>' + LINK_PATTERN = r'<p class="manager-server"><strong>([^<]+)</strong></p><p class="manager-linky"><a href="([^"]+)">' + + + def decrypt(self, pyfile): + self.html = self.load(pyfile.url, decode=True) + + if re.match(self.__pattern__, pyfile.url).group(1) == "slozka": + m = re.search(self.FOLDER_PATTERN, self.html) + if m: + self.urls.extend(m.group(1).split()) + else: + m = re.findall(self.LINK_PATTERN, self.html) + if m: + prefered_set = set(self.getConfig("usedHoster").split('|')) + self.urls.extend([x[1] for x in m if x[0] in prefered_set]) + + if not self.urls: + ignored_set = set(self.getConfig("ignoredHoster").split('|')) + self.urls.extend([x[1] for x in m if x[0] not in ignored_set]) |