# -*- coding: utf-8 -*- import re from module.plugins.Crypter import Crypter class MultiloadCz(Crypter): __name__ = "MultiloadCz" __type__ = "crypter" __pattern__ = r"http://.*multiload.cz/(stahnout|slozka)/.*" __version__ = "0.3" __description__ = """multiload.cz""" __config__ = [("usedHoster", "str", "Prefered hoster list (bar-separated) ", ""), ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")] __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") FOLDER_PATTERN = r'
]*>([^>]*)' LINK_PATTERN = r'

([^<]+)

' def decrypt(self, pyfile): self.html = self.load(self.pyfile.url, decode=True) new_links = [] if re.search(self.__pattern__, self.pyfile.url).group(1) == "slozka": found = re.search(self.FOLDER_PATTERN, self.html) if found is not None: new_links.extend(found.group(1).split()) else: found = re.findall(self.LINK_PATTERN, self.html) if found: prefered_set = set(self.getConfig("usedHoster").split('|')) def fp(x): return x[0] in prefered_set def m(x): return x[1] new_links.extend(map(m,filter(fp, found))) if not new_links: ignored_set = set(self.getConfig("ignoredHoster").split('|')) def fi(x): return x[0] not in ignored_set new_links.extend(map(m,filter(fi, found))) if new_links: self.core.files.addLinks(new_links, self.pyfile.package().id) else: self.fail('Could not extract any links')