diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-28 16:27:29 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-28 16:27:29 +0200 |
commit | 2e4101c6b373867d556a410901efb8c85c56593f (patch) | |
tree | 6aa8884afa3e5a46a8eb2ac547329c91ffcc9a9d /module/plugins/internal | |
parent | [XFileSharingPro] COOKIES preset to english + improved setup routine (diff) | |
download | pyload-2e4101c6b373867d556a410901efb8c85c56593f.tar.xz |
Prepare method improves setup one
Diffstat (limited to 'module/plugins/internal')
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 16 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 14 |
2 files changed, 19 insertions, 11 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 3c783bcab..2873a7fa7 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -10,7 +10,7 @@ from module.utils import html_unescape class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = None @@ -58,18 +58,20 @@ class SimpleCrypter(Crypter): LOGIN_PREMIUM = False - def setup(self): - if isinstance(self.COOKIES, list): - set_cookies(self.req.cj, self.COOKIES) - - - def decrypt(self, pyfile): + def prepare(self): if self.LOGIN_ACCOUNT and not self.account: self.fail('Required account not found!') if self.LOGIN_PREMIUM and not self.premium: self.fail('Required premium account not found!') + if isinstance(self.COOKIES, list): + set_cookies(self.req.cj, 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) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index ecbeec979..1c0916541 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -153,13 +153,13 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __pattern__ = None __description__ = """Simple hoster plugin""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __author_name__ = ("zoidberg", "stickell", "Walter Purcaro") + __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") """ Following patterns should be defined by each hoster: @@ -197,13 +197,19 @@ class SimpleHoster(Hoster): def setup(self): self.resumeDownload = self.multiDL = self.premium + + + def prepare(self): if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) + self.req.setOption("timeout", 120) def process(self, pyfile): + self.prepare() + pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) - self.req.setOption("timeout", 120) + # 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) |