diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-29 23:02:24 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-29 23:02:24 +0100 |
commit | d4719096cad1127540c32bb22345ebcba8617fa9 (patch) | |
tree | 005f549500b0bd22dd62e2fbfab88fe905c8e652 | |
parent | [SimpleHoster] Fix _getDirectLink (2) (diff) | |
download | pyload-d4719096cad1127540c32bb22345ebcba8617fa9.tar.xz |
[SimpleHoster] Fix _getDirectLink (3)
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 274d95154..24a2fa6b0 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -5,8 +5,6 @@ import re from time import time from urlparse import urlparse -from pycurl import FOLLOWLOCATION - from module.PyFile import statusMap as _statusMap from module.network.CookieJar import CookieJar from module.network.RequestFactory import getURL @@ -34,7 +32,11 @@ def _error(self, reason, type): #@TODO: Remove in 0.4.10 def _wait(self, seconds, reconnect): if seconds: - self.setWait(seconds, reconnect) + self.setWait(seconds) + + if reconnect is not None: + self.wantReconnect = reconnect + super(SimpleHoster, self).wait() @@ -114,19 +116,22 @@ def timestamp(): def _getDirectLink(self, url): header = self.load(url, ref=True, just_header=True, decode=True) - if not 'location' in header or not header['location']: + if not 'code' in header or header['code'] != 302: return "" - if header['code'] != 302 or 'content-type' in header and "text/plain" not in header['content-type']: + if not 'location' in header or not header['location']: return "" + # if 'content-type' in header and "text/plain" not in header['content-type']: + # return "" + return header['location'] class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.66" + __version__ = "0.67" __pattern__ = r'^unmatchable$' @@ -197,7 +202,7 @@ class SimpleHoster(Hoster): @classmethod def getInfo(cls, url="", html=""): - info = {'name': urlparse(url).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url or ""} + info = {'name': urlparse(url).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url or ""} if not html: if url: |