diff options
Diffstat (limited to 'module/plugins/crypter/MultiloadCz.py')
-rw-r--r-- | module/plugins/crypter/MultiloadCz.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py index f34bb3483..e8dff403e 100644 --- a/module/plugins/crypter/MultiloadCz.py +++ b/module/plugins/crypter/MultiloadCz.py @@ -7,14 +7,15 @@ class MultiloadCz(Crypter): __name__ = "MultiloadCz" __type__ = "crypter" __pattern__ = r"http://.*multiload.cz/(stahnout|slozka)/.*" - __version__ = "0.2b" + __version__ = "0.3" __description__ = """multiload.cz""" - __config__ = [ - ("usedHoster", "str", "Prefered hoster list (bar-separated) ", "rapidshare.com|uloz.to|quickshare.cz")] + __config__ = [("usedHoster", "str", "Prefered hoster list (bar-separated) ", ""), + ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")] __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") - # LINK_PATTERN = r'<p class="manager-server"><strong>[^<]*</strong></p><p class="manager-linky"><a href="([^"]+)">' 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(self.pyfile.url, decode=True) @@ -25,17 +26,19 @@ class MultiloadCz(Crypter): if found is not None: new_links.extend(found.group(1).split()) else: - link_pattern = re.compile(r'<p class="manager-server"><strong>(' - + self.getConfig("usedHoster") - + r')</strong></p><p class="manager-linky"><a href="([^"]+)">') + 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))) - for found in re.finditer(link_pattern, self.html): - self.logDebug("ML URL:" + found.group(2)) - new_links.append(found.group(2)) + 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) - #self.packages.append((self.pyfile.package().name, new_links, self.pyfile.package().name)) else: - self.fail('Could not extract any links') -
\ No newline at end of file + self.fail('Could not extract any links')
\ No newline at end of file |