From 924b9e2e7e0d651662b4bd00936b7f4675e7947f Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Tue, 20 Sep 2011 17:10:52 +0200 Subject: New plugins: HellspyCz, LetitbitNet, FreevideoCz, StreamCz, UlozToFolder --- module/plugins/crypter/MultiloadCz.py | 29 +++++++++++++----------- module/plugins/crypter/UlozToFolder.py | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 module/plugins/crypter/UlozToFolder.py (limited to 'module/plugins/crypter') 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'

[^<]*

' FOLDER_PATTERN = r'

]*>([^>]*)' + LINK_PATTERN = r'

([^<]+)

' 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'

(' - + self.getConfig("usedHoster") - + r')

') + 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'

' + LINK_PATTERN = r'
[^<]+' + NEXT_PAGE_PATTERN = r'' + + 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 -- cgit v1.2.3