diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-20 12:59:27 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-20 12:59:27 +0200 |
commit | 4e0e93fe8a9c9a98f3f299afacf07fbc855ef88b (patch) | |
tree | e230f8d4e17bfc716f6e78a078d5d568502a3600 | |
parent | Fix download resume feature (diff) | |
download | pyload-4e0e93fe8a9c9a98f3f299afacf07fbc855ef88b.tar.xz |
Preload self.html
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 10 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 11 | ||||
-rw-r--r-- | module/plugins/internal/XFSPHoster.py | 9 |
3 files changed, 12 insertions, 18 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index f1def8118..b09ee6ac2 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -2,6 +2,7 @@ import re +from module.network.RequestFactory import getURL from module.plugins.Crypter import Crypter from module.plugins.Plugin import Fail from module.plugins.internal.SimpleHoster import replace_patterns, set_cookies @@ -11,7 +12,7 @@ from module.utils import fixup, html_unescape class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = None @@ -86,14 +87,13 @@ class SimpleCrypter(Crypter): if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) + url = self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS) + self.html = getURL(url, decode=not self.TEXT_ENCODING, cookies=self.COOKIES) + def decrypt(self, pyfile): self.prepare() - pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) - - self.html = self.load(pyfile.url, decode=not self.TEXT_ENCODING) - self.checkOnline() package_name, folder_name = self.getPackageNameAndFolder() diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index c62ef53b4..6fc61460a 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -204,17 +204,16 @@ class SimpleHoster(Hoster): def prepare(self): if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) + self.req.setOption("timeout", 120) + url = self.pyfile.url = replace_patterns(self.pyfile.url, self.FILE_URL_REPLACEMENTS) + self.html = getURL(url, decode=not self.TEXT_ENCODING, cookies=self.COOKIES) + def process(self, pyfile): self.prepare() - pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) - - # 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.4.10 as the cookies bug has been fixed. - self.html = getURL(pyfile.url, decode=not self.TEXT_ENCODING, cookies=self.COOKIES) 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() @@ -224,8 +223,6 @@ class SimpleHoster(Hoster): 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.4.10 - self.html = self.load(pyfile.url, decode=not self.TEXT_ENCODING) self.handleFree() diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSPHoster.py index 0b656c67c..14c8302e1 100644 --- a/module/plugins/internal/XFSPHoster.py +++ b/module/plugins/internal/XFSPHoster.py @@ -75,12 +75,13 @@ class XFSPHoster(SimpleHoster): self.errmsg = None self.passwords = self.getPassword().splitlines() + url = self.pyfile.url = replace_patterns(self.pyfile.url, self.FILE_URL_REPLACEMENTS) + self.html = getURL(url, decode=not self.TEXT_ENCODING, cookies=self.COOKIES) + def process(self, pyfile): self.prepare() - pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) - if not re.match(self.__pattern__, pyfile.url): if self.premium: self.handleOverriden() @@ -88,10 +89,6 @@ class XFSPHoster(SimpleHoster): self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME) else: try: - # Due to a 0.4.9 core bug self.load would use cookies even if - # cookies=False. Workaround using getURL to avoid cookies. - # Can be reverted in 0.4.10 as the cookies bug has been fixed. - self.html = getURL(pyfile.url, decode=not self.TEXT_ENCODING, cookies=self.COOKIES) self.file_info = self.getFileInfo() except Fail: self.file_info = None |