diff options
author | Stefano <l.stickell@yahoo.it> | 2014-07-02 15:24:23 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-07-02 15:24:23 +0200 |
commit | 59dbd29405af5847fc69a9801db23a695972cfd6 (patch) | |
tree | aab860ec6eccd57048c337ea7139150c6310a2fa /module/plugins/crypter | |
parent | [SimpleCrypter] ability to set cookies (diff) | |
download | pyload-59dbd29405af5847fc69a9801db23a695972cfd6.tar.xz |
[FilefactoryComFolder] Rewritten
Fixes #648
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r-- | module/plugins/crypter/FilefactoryComFolder.py | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py index aece1a01d..2147c48df 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -1,45 +1,22 @@ # -*- coding: utf-8 -*- -import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class FilefactoryComFolder(Crypter): +class FilefactoryComFolder(SimpleCrypter): __name__ = "FilefactoryComFolder" __type__ = "crypter" - __pattern__ = r'(http://(?:www\.)?filefactory\.com/f/\w+).*' - __version__ = "0.1" + __pattern__ = r'https?://(?:www\.)?filefactory\.com/(?:f|folder)/\w+' + __version__ = "0.2" __description__ = """Filefactory.com folder decrypter plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __author_name__ = "stickell" + __author_mail__ = "l.stickell@yahoo.it" - FOLDER_PATTERN = r'<table class="items" cellspacing="0" cellpadding="0">(.*?)</table>' - LINK_PATTERN = r'<td class="name"><a href="([^"]+)">' - PAGINATOR_PATTERN = r'<div class="list">\s*<label>Pages</label>\s*<ul>(.*?)</ul>\s*</div>' - NEXT_PAGE_PATTERN = r'<li class="current">.*?</li>\s*<li class=""><a href="([^"]+)">' + LINK_PATTERN = r'<td><a href="([^"]+)">' + TITLE_PATTERN = r'<h1>Files in <span>(?P<title>.+)</span></h1>' + PAGES_PATTERN = r'data-paginator-totalPages="(?P<pages>\d+)"' - def decrypt(self, pyfile): - url_base = re.match(self.__pattern__, pyfile.url).group(1) - html = self.load(url_base) + SH_COOKIES = [('.filefactory.com', 'locale', 'en_US.utf8')] - new_links = [] - for i in xrange(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, pyfile.package().id) - else: - self.fail('Could not extract any links') + def loadPage(self, page_n): + return self.load(self.pyfile.url, get={'page': page_n}) |