diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2011-09-20 17:10:52 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2011-09-20 17:10:52 +0200 |
commit | 924b9e2e7e0d651662b4bd00936b7f4675e7947f (patch) | |
tree | 8b723b917a95fbb0ab26253e32cdd963cc7f5c44 /module/plugins/crypter | |
parent | general JSON API, url parser (diff) | |
download | pyload-924b9e2e7e0d651662b4bd00936b7f4675e7947f.tar.xz |
New plugins: HellspyCz, LetitbitNet, FreevideoCz, StreamCz, UlozToFolder
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r-- | module/plugins/crypter/MultiloadCz.py | 29 | ||||
-rw-r--r-- | module/plugins/crypter/UlozToFolder.py | 40 |
2 files changed, 56 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 diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py new file mode 100644 index 000000000..c6672ea8c --- /dev/null +++ b/module/plugins/crypter/UlozToFolder.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class UlozToFolder(Crypter): + __name__ = "UlozToFolder" + __type__ = "crypter" + __pattern__ = r"http://.*(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(m|soubory)/.*" + __version__ = "0.1a" + __description__ = """Uloz.to Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FOLDER_PATTERN = r'<ul class="profile_files">(.*?)</ul>' + LINK_PATTERN = r'<br /><a href="/([^"]+)">[^<]+</a>' + NEXT_PAGE_PATTERN = r'<a class="next " href="/([^"]+)"> </a>' + + def decrypt(self, pyfile): + html = self.load(self.pyfile.url) + + new_links = [] + for i in range(1,100): + self.logInfo("Fetching links from page %i" % i) + found = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + if found is None: self.fail("Parse error (FOLDER)") + + new_links.extend(re.findall(self.LINK_PATTERN, found.group(1))) + found = re.search(self.NEXT_PAGE_PATTERN, html) + if found: + html = self.load("http://ulozto.net/" + found.group(1)) + else: + break + else: + self.logInfo("Limit of 99 pages reached, aborting") + + if new_links: + self.core.files.addLinks(map(lambda s:"http://ulozto.net/%s" % s, new_links), self.pyfile.package().id) + else: + self.fail('Could not extract any links')
\ No newline at end of file |