From 3fe4fa00320c8838175c481e50e34cf6481eb7a3 Mon Sep 17 00:00:00 2001 From: Stefano Date: Thu, 16 Jan 2014 13:36:16 +0100 Subject: 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) --- pyload/plugins/internal/SimpleHoster.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'pyload/plugins/internal/SimpleHoster.py') 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): -- cgit v1.2.3