diff options
Diffstat (limited to 'module/plugins/crypter/FilefactoryComFolder.py')
| -rw-r--r-- | module/plugins/crypter/FilefactoryComFolder.py | 66 | 
1 files changed, 26 insertions, 40 deletions
| diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py index aece1a01d..26e28acbd 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -1,45 +1,31 @@  # -*- coding: utf-8 -*- -import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -class FilefactoryComFolder(Crypter): -    __name__ = "FilefactoryComFolder" -    __type__ = "crypter" -    __pattern__ = r'(http://(?:www\.)?filefactory\.com/f/\w+).*' -    __version__ = "0.1" +class FilefactoryComFolder(SimpleCrypter): +    __name__    = "FilefactoryComFolder" +    __type__    = "crypter" +    __version__ = "0.31" + +    __pattern__ = r'https?://(?:www\.)?filefactory\.com/(?:f|folder)/\w+' +    __config__  = [("use_subfolder", "bool", "Save package to subfolder", True), +                   ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] +      __description__ = """Filefactory.com folder decrypter plugin""" -    __author_name__ = "zoidberg" -    __author_mail__ = "zoidberg@mujmail.cz" - -    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="([^"]+)">' - -    def decrypt(self, pyfile): -        url_base = re.match(self.__pattern__, pyfile.url).group(1) -        html = self.load(url_base) - -        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') +    __license__     = "GPLv3" +    __authors__     = [("stickell", "l.stickell@yahoo.it")] + + +    LINK_PATTERN = r'<td><a href="([^"]+)">' +    NAME_PATTERN = r'<h1>Files in <span>(?P<N>.+)</span></h1>' +    PAGES_PATTERN = r'data-paginator-totalPages="(\d+)"' + +    COOKIES = [("filefactory.com", "locale", "en_US.utf8")] + + +    def loadPage(self, page_n): +        return self.load(self.pyfile.url, get={'page': page_n}) + + +getInfo = create_getInfo(FilefactoryComFolder) | 
