From 2839c54c090f2601fcecd0f7fdaeacc40c7716f5 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Fri, 23 Sep 2011 12:25:18 +0200 Subject: plugins: czshare premium, czshare/quickshare/filefactory folders --- module/plugins/crypter/CzshareComFolder.py | 30 ++++++++++++++++++ module/plugins/crypter/FilefactoryComFolder.py | 44 ++++++++++++++++++++++++++ module/plugins/crypter/MultiloadCz.py | 9 ++---- module/plugins/crypter/QuickshareCzFolder.py | 30 ++++++++++++++++++ 4 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 module/plugins/crypter/CzshareComFolder.py create mode 100644 module/plugins/crypter/FilefactoryComFolder.py create mode 100644 module/plugins/crypter/QuickshareCzFolder.py (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/CzshareComFolder.py b/module/plugins/crypter/CzshareComFolder.py new file mode 100644 index 000000000..c240c6a70 --- /dev/null +++ b/module/plugins/crypter/CzshareComFolder.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class CzshareComFolder(Crypter): + __name__ = "CzshareComFolder" + __type__ = "crypter" + __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/folders/.*" + __version__ = "0.1" + __description__ = """Czshare.com Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FOLDER_PATTERN = r'\s*\s*(.*?)
' + LINK_PATTERN = r'info' + #NEXT_PAGE_PATTERN = r'' + + def decrypt(self, pyfile): + html = self.load(self.pyfile.url) + + new_links = [] + 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))) + + if new_links: + self.core.files.addLinks(new_links, self.pyfile.package().id) + else: + self.fail('Could not extract any links') \ No newline at end of file diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py new file mode 100644 index 000000000..32793b491 --- /dev/null +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class FilefactoryComFolder(Crypter): + __name__ = "FilefactoryComFolder" + __type__ = "crypter" + __pattern__ = r"(http://(www\.)?filefactory\.com/f/\w+).*" + __version__ = "0.1" + __description__ = """Filefactory.com Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FOLDER_PATTERN = r'(.*?)
' + LINK_PATTERN = r'' + PAGINATOR_PATTERN = r'
\s*\s*
    (.*?)
\s*
' + NEXT_PAGE_PATTERN = r'
  • .*?
  • \s*
  • ' + + def decrypt(self, pyfile): + url_base = re.search(self.__pattern__, self.pyfile.url).group(1) + html = self.load(url_base) + + 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))) + + try: + paginator = re.search(self.PAGINATOR_PATTERN, html, re.DOTALL).group(1) + next_page = re.search(self.NEXT_PAGE_PATTERN, paginator).group(1) + html = self.load("%s/%s" % (url_base, next_page)) + except Exception, e: + break + else: + self.logInfo("Limit of 99 pages reached, aborting") + + if new_links: + self.core.files.addLinks(new_links, self.pyfile.package().id) + else: + self.fail('Could not extract any links') \ No newline at end of file diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py index e8dff403e..2c71b8fea 100644 --- a/module/plugins/crypter/MultiloadCz.py +++ b/module/plugins/crypter/MultiloadCz.py @@ -7,7 +7,7 @@ class MultiloadCz(Crypter): __name__ = "MultiloadCz" __type__ = "crypter" __pattern__ = r"http://.*multiload.cz/(stahnout|slozka)/.*" - __version__ = "0.3" + __version__ = "0.4" __description__ = """multiload.cz""" __config__ = [("usedHoster", "str", "Prefered hoster list (bar-separated) ", ""), ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")] @@ -29,14 +29,11 @@ class MultiloadCz(Crypter): 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))) + new_links.extend([x[1] for x in found if x[0] in prefered_set]) 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))) + new_links.extend([x[1] for x in found if x[0] not in ignored_set]) if new_links: self.core.files.addLinks(new_links, self.pyfile.package().id) diff --git a/module/plugins/crypter/QuickshareCzFolder.py b/module/plugins/crypter/QuickshareCzFolder.py new file mode 100644 index 000000000..6cb049935 --- /dev/null +++ b/module/plugins/crypter/QuickshareCzFolder.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Crypter import Crypter + +class QuickshareCzFolder(Crypter): + __name__ = "QuickshareCzFolder" + __type__ = "crypter" + __pattern__ = r"http://(www\.)?quickshare.cz/slozka-\d+.*" + __version__ = "0.1" + __description__ = """Quickshare.cz Folder Plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + + FOLDER_PATTERN = r']*>(.*?)' + LINK_PATTERN = r'(http://www.quickshare.cz/\S+)' + + def decrypt(self, pyfile): + html = self.load(self.pyfile.url) + + new_links = [] + 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))) + + if new_links: + self.core.files.addLinks(new_links, self.pyfile.package().id) + else: + self.fail('Could not extract any links') \ No newline at end of file -- cgit v1.2.3