summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/SimpleCrypter.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-28 04:48:14 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-28 04:48:14 +0100
commit127bfffafbbae49fc4aaf0db677dcc5f73e7720d (patch)
tree4707af8003e007e5c9d9f70f6f6f87c42cb069e5 /module/plugins/internal/SimpleCrypter.py
parentMerge pull request #2129 from thadrien/pull-request-SimpleHoster (diff)
parentIncrease version number in SimpleCrypter.py (diff)
downloadpyload-127bfffafbbae49fc4aaf0db677dcc5f73e7720d.tar.xz
Merge pull request #2128 from thadrien/pull-request-dlprotect
Pull request dlprotect
Diffstat (limited to 'module/plugins/internal/SimpleCrypter.py')
-rw-r--r--module/plugins/internal/SimpleCrypter.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index f37323f90..59b9acc31 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -11,7 +11,7 @@ from module.plugins.internal.utils import replace_patterns, set_cookie, set_cook
class SimpleCrypter(Crypter):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.78"
+ __version__ = "0.79"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -149,24 +149,26 @@ class SimpleCrypter(Crypter):
def handle_direct(self, pyfile):
- link = None
+ redirect = None
maxredirs = self.get_config("maxredirs", default=10, plugin="UserAgentSwitcher")
for i in xrange(maxredirs):
- url = link or pyfile.url
- self.log_debug("Redirect #%d to: %s" % (i, url))
+ redirect = redirect or pyfile.url
+ self.log_debug("Redirect #%d to: %s" % (i, redirect))
- header = self.load(url, just_header=True)
+ data = self.load(redirect)
+ header = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", self.req.http.header))
+ #Ugly, but there is no direct way to fetch headers AND data
location = header.get('location')
if location:
- link = location
-
- elif link:
- self.links.append(link)
+ redirect = location
+ else:
+ self.data = data
+ self.links.extend(self.get_links())
return
else:
- self.log_warning(_("Too many redirects"))
+ self.log_error(_("Too many redirects"))
def preload(self):