diff options
author | Stefano <l.stickell@yahoo.it> | 2013-04-06 21:38:27 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-04-06 21:38:27 +0200 |
commit | cf299b2955c82bd13efd61446570df8baef942ff (patch) | |
tree | faeb5fe53fe99f56ad7fecb52d536ca7a9840080 /module/plugins | |
parent | DebridItaliaCom: fail instead of offline to allow revert to traditional download (diff) | |
download | pyload-cf299b2955c82bd13efd61446570df8baef942ff.tar.xz |
NetfolderIn, SimpleCrypter: stripping folder name.
+ cosmetics
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/crypter/NetfolderIn.py | 35 | ||||
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 2 |
2 files changed, 17 insertions, 20 deletions
diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py index d71a73d0a..956727d87 100644 --- a/module/plugins/crypter/NetfolderIn.py +++ b/module/plugins/crypter/NetfolderIn.py @@ -1,22 +1,23 @@ # -*- coding: utf-8 -*- -from module.plugins.Crypter import Crypter import re +from module.plugins.Crypter import Crypter + + class NetfolderIn(Crypter): __name__ = "NetfolderIn" __type__ = "crypter" __pattern__ = r"http://(?:www\.)?netfolder.in/((?P<id1>\w+)/\w+|folder.php\?folder_id=(?P<id2>\w+))" - __version__ = "0.4" + __version__ = "0.5" __description__ = """NetFolder Crypter Plugin""" __author_name__ = ("RaNaN", "fragonib") __author_mail__ = ("RaNaN@pyload.org", "fragonib[AT]yahoo[DOT]es") def decrypt(self, pyfile): - # Request package self.html = self.load(pyfile.url) - + # Check for password protection if self.isPasswordProtected(): self.html = self.submitPassword() @@ -31,45 +32,42 @@ class NetfolderIn(Crypter): # Set package self.packages = [(package_name, package_links, folder_name)] - - + def isPasswordProtected(self): - + if '<input type="password" name="password"' in self.html: self.logDebug("Links are password protected") 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')) + id = max(m.group('id1'), m.group('id2')) 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 - post = { 'password' : password, 'save' : 'Absenden' } + post = {'password': password, 'save': 'Absenden'} self.logDebug("Submitting password [%s] for protected links with id [%s]" % (password, id)) html = self.load(url, {}, post) - + # Check for invalid password if '<div class="InPage_Error">' in html: self.logDebug("Incorrect password, please set right password on Edit package form and retry") return None - - return html - - + + return html + def getPackageNameAndFolder(self): title_re = r'<div class="Text">Inhalt des Ordners <span(.*)>(?P<title>.+)</span></div>' m = re.search(title_re, self.html) if m is not None: - name = folder = m.group('title') + name = folder = m.group('title').strip() self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) return name, folder else: @@ -77,8 +75,7 @@ class NetfolderIn(Crypter): folder = self.pyfile.package().folder self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) return name, folder - - + def getLinks(self): links = re.search(r'name="list" value="(.*?)"', self.html).group(1).split(",") self.logDebug("Package has %d links" % len(links)) diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index b2cc03985..c9e350e86 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -57,7 +57,7 @@ class SimpleCrypter(Crypter): if hasattr(self, 'TITLE_PATTERN'): m = re.search(self.TITLE_PATTERN, self.html) if m: - name = folder = m.group('title') + name = folder = m.group('title').strip() self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) return name, folder |