diff options
author | Stefano <l.stickell@yahoo.it> | 2014-01-16 13:36:16 +0100 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-04-21 16:54:48 +0200 |
commit | 3fe4fa00320c8838175c481e50e34cf6481eb7a3 (patch) | |
tree | d5c611f6cb0e141554056585ee64384cf091371b | |
parent | New hoster: SoundcloudCom (diff) | |
download | pyload-3fe4fa00320c8838175c481e50e34cf6481eb7a3.tar.xz |
SimpleHoster: improved PREMIUM_ONLY process
Usually premium only pages doesn't show the file information so trying to get them would raise an exception.
(cherry picked from commit cd9aebb7ed4e742fe17b09e0886341367662b2c7)
-rw-r--r-- | pyload/plugins/internal/SimpleHoster.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pyload/plugins/internal/SimpleHoster.py b/pyload/plugins/internal/SimpleHoster.py index 47fded260..46d0a9517 100644 --- a/pyload/plugins/internal/SimpleHoster.py +++ b/pyload/plugins/internal/SimpleHoster.py @@ -163,7 +163,7 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" - __version__ = "0.32" + __version__ = "0.33" __pattern__ = None __type__ = "hoster" __description__ = """Base hoster plugin""" @@ -202,14 +202,17 @@ class SimpleHoster(Hoster): # Due to a 0.4.9 core bug self.load would keep previous cookies even if overridden by cookies parameter. # Workaround using getURL. Can be reverted in 0.5 as the cookies bug has been fixed. self.html = getURL(pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES) - self.getFileInfo() + premium_only = hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html) + if not premium_only: # Usually premium only pages doesn't show the file information + self.getFileInfo() + if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()): self.handlePremium() + elif premium_only: + self.fail("This link require a premium account") else: # This line is required due to the getURL workaround. Can be removed in 0.5 self.html = self.load(pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES) - if hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html): - self.fail("This link require a premium account") self.handleFree() def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False): |