From 6343210720782fa99f679f87447c1418ee5875cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 13 Jan 2015 01:43:29 +0100 Subject: [SimpleCrypter] getLinks auto-complete links --- module/plugins/internal/SimpleCrypter.py | 10 +++++++--- module/plugins/internal/SimpleHoster.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'module') diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 43b1347fd..d33ad77e9 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -2,7 +2,7 @@ import re -from urlparse import urlparse +from urlparse import urljoin, urlparse from module.plugins.Crypter import Crypter from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies @@ -12,7 +12,7 @@ from module.utils import fixup class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.38" + __version__ = "0.39" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] @@ -151,7 +151,11 @@ class SimpleCrypter(Crypter, SimpleHoster): Returns the links extracted from self.html You should override this only if it's impossible to extract links using only the LINK_PATTERN. """ - return re.findall(self.LINK_PATTERN, self.html) + parsed = urlparse(self.pyfile.url) + base = "%s://%s" % (parsed.scheme, parsed.netloc) + + return [urljoin(base, link) if not urlparse(link).scheme else link \ + for link in re.finditer(self.LINK_PATTERN, self.html)] def handlePages(self, pyfile): diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index fa1ea45f2..4c3d376ca 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -145,8 +145,8 @@ def directLink(self, url, resumable=False): location = header['location'] if not urlparse(location).scheme: - p = urlparse(url) - base = "%s://%s" % (p.scheme, p.netloc) + parsed = urlparse(url) + base = "%s://%s" % (parsed.scheme, parsed.netloc) location = urljoin(base, location) if resumable: -- cgit v1.2.3