diff options
| author | 2014-12-26 17:24:41 +0100 | |
|---|---|---|
| committer | 2014-12-26 17:24:41 +0100 | |
| commit | c7187f2142c6e06be961bb3be45ea3b61ce31651 (patch) | |
| tree | fb713598b689310f6b1b2720c0102502aea306be /module/plugins/internal | |
| parent | [ShareonlineBiz] Fix login (diff) | |
| download | pyload-c7187f2142c6e06be961bb3be45ea3b61ce31651.tar.xz | |
[SimpleHoster] getInfo handle direct link error
Diffstat (limited to 'module/plugins/internal')
| -rw-r--r-- | module/plugins/internal/MultiHoster.py | 4 | ||||
| -rw-r--r-- | module/plugins/internal/SimpleHoster.py | 23 | 
2 files changed, 17 insertions, 10 deletions
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 6bfff171b..9d218c3b2 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r  class MultiHoster(SimpleHoster):      __name__    = "MultiHoster"      __type__    = "hoster" -    __version__ = "0.25" +    __version__ = "0.26"      __pattern__ = r'^unmatchable$' @@ -57,7 +57,7 @@ class MultiHoster(SimpleHoster):          if not self.link and not self.lastDownload:              self.preload() -            if self.premium and not self.CHECK_TRAFFIC or self.checkTrafficLeft(): +            if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):                  self.logDebug("Handled as premium download")                  self.handlePremium() diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 56c25e0d9..89d2e629c 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -160,7 +160,7 @@ def _isDirectLink(self, url, resumable=False):  class SimpleHoster(Hoster):      __name__    = "SimpleHoster"      __type__    = "hoster" -    __version__ = "0.80" +    __version__ = "0.81"      __pattern__ = r'^unmatchable$' @@ -233,7 +233,13 @@ class SimpleHoster(Hoster):      @classmethod      def getInfo(cls, url="", html=""): -        info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url} +        info   = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url} +        online = False + +        try: +            info['pattern'] = re.match(cls.__pattern__, url).groupdict()  #: pattern groups will be saved here, please save api stuff to info['api'] +        except Exception: +            pass          if not html:              try: @@ -242,6 +248,11 @@ class SimpleHoster(Hoster):                      info['status'] = 1                      raise +                if _isDirectLink(url): +                    info['error']  = "direct link" +                    info['status'] = 2 +                    raise +                  try:                      html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING) @@ -261,8 +272,6 @@ class SimpleHoster(Hoster):              except:                  return info -        online = False -          if hasattr(cls, "OFFLINE_PATTERN") and re.search(cls.OFFLINE_PATTERN, html):              info['status'] = 1 @@ -273,9 +282,7 @@ class SimpleHoster(Hoster):              info['status'] = 6          else: -            try: -                info['pattern'] = re.match(cls.__pattern__, url).groupdict()  #: pattern groups will be saved here, please save api stuff to info['api'] -            except: +            if not 'pattern' in info:                  info['pattern'] = {}              for pattern in ("FILE_INFO_PATTERN", "INFO_PATTERN", @@ -381,7 +388,7 @@ class SimpleHoster(Hoster):              if self.html is None:                  self.fail(_("No html retrieved")) -            if self.premium and not self.CHECK_TRAFFIC or self.checkTrafficLeft(): +            if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):                  self.logDebug("Handled as premium download")                  self.handlePremium()  | 
