From b409e7782d48830489f47cc2364b4728d98f363a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 02:06:31 +0200 Subject: Improve COOKIES parsing --- module/plugins/internal/SimpleHoster.py | 5 +++-- module/plugins/internal/XFSPHoster.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'module') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 6fc61460a..74910692f 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -67,7 +67,7 @@ def parseHtmlForm(attr_str, html, input_names=None): return {}, None # no matching form found -def parseFileInfo(self, url='', html=''): +def parseFileInfo(self, url="", html=""): info = {"name": url, "size": 0, "status": 3} if hasattr(self, "pyfile"): @@ -129,6 +129,7 @@ def create_getInfo(plugin): cj = CookieJar(plugin.__name__) if isinstance(plugin.COOKIES, list): set_cookies(cj, plugin.COOKIES) + file_info = parseFileInfo(plugin, url, getURL(replace_patterns(url, plugin.FILE_URL_REPLACEMENTS), decode=not plugin.TEXT_ENCODING, cookies=cj)) yield file_info @@ -208,7 +209,7 @@ class SimpleHoster(Hoster): 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) + self.html = getURL(url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES)) def process(self, pyfile): diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSPHoster.py index 14c8302e1..5d75e41a7 100644 --- a/module/plugins/internal/XFSPHoster.py +++ b/module/plugins/internal/XFSPHoster.py @@ -76,7 +76,7 @@ class XFSPHoster(SimpleHoster): 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) + self.html = getURL(url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES)) def process(self, pyfile): -- cgit v1.2.3