From 7e65484b60890bbfa39aa7631343dcfb5c379cf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 26 May 2015 01:25:05 +0200 Subject: [GoogledriveCom] Fixup --- module/plugins/internal/SimpleCrypter.py | 10 ++++++---- module/plugins/internal/SimpleHoster.py | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 46ccb11b5..48e1e0fab 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -5,13 +5,13 @@ import urlparse from module.plugins.Crypter import Crypter from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies -from module.utils import fixup +from module.utils import fixup, html_unescape class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.45" + __version__ = "0.46" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package'] @@ -152,8 +152,10 @@ class SimpleCrypter(Crypter, SimpleHoster): url_p = urlparse.urlparse(self.pyfile.url) baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) - return [(urlparse.urljoin(baseurl, link) if not urlparse.urlparse(link).scheme else link).decode('unicode-escape') \ - for link in re.findall(self.LINK_PATTERN, self.html)] + links = [urlparse.urljoin(baseurl, link) if not urlparse.urlparse(link).scheme else link \ + for link in re.findall(self.LINK_PATTERN, self.html)] + + return [html_unescape(l.decode('unicode-escape')) for l in links] def handlePages(self, pyfile): diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 11c6c64f2..d3c269548 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -14,7 +14,7 @@ from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster from module.plugins.Plugin import Fail, Retry -from module.utils import fixup, fs_encode, parseFileSize +from module.utils import fixup, fs_encode, html_unescape, parseFileSize #@TODO: Adapt and move to PyFile in 0.4.10 @@ -239,7 +239,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.48" + __version__ = "1.49" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available" , True), @@ -504,15 +504,19 @@ class SimpleHoster(Hoster): def downloadLink(self, link, disposition=True): - if link and isinstance(link, basestring): - self.correctCaptcha() + if not link or not isinstance(link, basestring): + return + + self.correctCaptcha() - if not urlparse.urlparse(link).scheme: - url_p = urlparse.urlparse(self.pyfile.url) - baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) - link = urlparse.urljoin(baseurl, link) + link = html_unescape(link.decode('unicode-escape')) #@TODO: Move this check to plugin `load` method - self.download(link, ref=False, disposition=disposition) + if not urlparse.urlparse(link).scheme: + url_p = urlparse.urlparse(self.pyfile.url) + baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) + link = urlparse.urljoin(baseurl, link) + + self.download(link, ref=False, disposition=disposition) def checkFile(self, rules={}): @@ -794,7 +798,8 @@ class SimpleHoster(Hoster): return size <= traffic - def getConfig(self, option, default=''): #@TODO: Remove in 0.4.10 + #@TODO: Remove in 0.4.10 + def getConfig(self, option, default=''): """getConfig with default value - sublass may not implements all config options""" try: return self.getConf(option) -- cgit v1.2.3