diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-15 22:24:08 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-24 22:38:47 +0200 |
commit | aeba469412a08a52f8fcd61b02dd5b9e481a4dff (patch) | |
tree | 83c2aabcd1a62e128d1ff5233a3ba863ecfc3ba1 /module/plugins/internal/SimpleHoster.py | |
parent | [NitroflareComFolder] Fixup (diff) | |
download | pyload-aeba469412a08a52f8fcd61b02dd5b9e481a4dff.tar.xz |
[SimpleHoster] fixurl
Diffstat (limited to 'module/plugins/internal/SimpleHoster.py')
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 58d8158ca..cec5f55f1 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -229,7 +229,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.68" + __version__ = "1.69" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available" , True), @@ -517,20 +517,27 @@ class SimpleHoster(Hoster): raise Fail(err) + def fixurl(self, url): + return self.fixurls([url])[0] + + + def fixurls(self, urls): + url_p = urlparse.urlparse(self.pyfile.url) + baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) + + urls = (html_unescape(url.decode('unicode-escape').strip()) for url in urls) + + return [urlparse.urljoin(baseurl, url) if not urlparse.urlparse(url).scheme else url \ + for url in urls] + + def download(self, url, *args, **kwargs): if not url or not isinstance(url, basestring): return self.correctCaptcha() - url = html_unescape(url.decode('unicode-escape').strip()) #@TODO: Move to Hoster in 0.4.10 - - if not urlparse.urlparse(url).scheme: - url_p = urlparse.urlparse(self.pyfile.url) - baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) - url = urlparse.urljoin(baseurl, url) - - return super(SimpleHoster, self).download(url, *args, **kwargs) + return super(SimpleHoster, self).download(self.fixurl(url), *args, **kwargs) def checkFile(self): |