diff options
Diffstat (limited to 'module/plugins/crypter/NetfolderIn.py')
-rw-r--r-- | module/plugins/crypter/NetfolderIn.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py index 4c7660ab5..62dc5c914 100644 --- a/module/plugins/crypter/NetfolderIn.py +++ b/module/plugins/crypter/NetfolderIn.py @@ -2,41 +2,36 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class NetfolderIn(SimpleCrypter): - __name__ = "NetfolderIn" - __version__ = "0.6" - __type__ = "crypter" + __name__ = "NetfolderIn" + __type__ = "crypter" + __version__ = "0.72" - __pattern__ = r'http://(?:www\.)?netfolder.in/((?P<id1>\w+)/\w+|folder.php\?folder_id=(?P<id2>\w+))' + __pattern__ = r'http://(?:www\.)?netfolder\.in/(folder\.php\?folder_id=)?(?P<ID>\w+)(?(1)|/\w+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """NetFolder.in decrypter plugin""" - __author_name__ = ("RaNaN", "fragonib") - __author_mail__ = ("RaNaN@pyload.org", "fragonib[AT]yahoo[DOT]es") + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("fragonib", "fragonib[AT]yahoo[DOT]es")] - TITLE_PATTERN = r'<div class="Text">Inhalt des Ordners <span(.*)>(?P<title>.+)</span></div>' + NAME_PATTERN = r'<div class="Text">Inhalt des Ordners <span.*>(?P<N>.+)</span></div>' - def decrypt(self, pyfile): - # Request package - self.html = self.load(pyfile.url) - # Check for password protection + def prepare(self): + super(NetfolderIn, self).prepare() + + # Check for password protection if self.isPasswordProtected(): self.html = self.submitPassword() if not self.html: - self.fail("Incorrect password, please set right password on Add package form and retry") - - # Get package name and folder - (package_name, folder_name) = self.getPackageNameAndFolder() + self.fail(_("Incorrect password, please set right password on Add package form and retry")) - # Get package links - package_links = self.getLinks() - - # Set package - self.packages = [(package_name, package_links, folder_name)] def isPasswordProtected(self): if '<input type="password" name="password"' in self.html: @@ -44,18 +39,19 @@ class NetfolderIn(SimpleCrypter): return True return False + def submitPassword(self): # Gather data try: - m = re.match(self.__pattern__, self.pyfile.url) - id = max(m.group('id1'), m.group('id2')) + m = re.match(self.__pattern__, self.pyfile.url) + id = m.group('ID') except AttributeError: self.logDebug("Unable to get package id from url [%s]" % self.pyfile.url) return url = "http://netfolder.in/folder.php?folder_id=" + id password = self.getPassword() - # Submit package password + # Submit package password post = {'password': password, 'save': 'Absenden'} self.logDebug("Submitting password [%s] for protected links with id [%s]" % (password, id)) html = self.load(url, {}, post) @@ -67,7 +63,11 @@ class NetfolderIn(SimpleCrypter): return html + def getLinks(self): links = re.search(r'name="list" value="(.*?)"', self.html).group(1).split(",") self.logDebug("Package has %d links" % len(links)) return links + + +getInfo = create_getInfo(NetfolderIn) |