diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-31 22:18:50 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-31 22:18:50 +0200 |
commit | f417ec942bab9ac3999a71808b8a0a1c09fb1037 (patch) | |
tree | ead0bafb4a41c1df45ad6737fa46d60396e2c274 /module | |
parent | automatically try to decode all request according to http header (diff) | |
download | pyload-f417ec942bab9ac3999a71808b8a0a1c09fb1037.tar.xz |
no autodecode , it may break some plugins
Diffstat (limited to 'module')
-rw-r--r-- | module/network/HTTPRequest.py | 15 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/YoutubeCom.py | 4 |
3 files changed, 14 insertions, 9 deletions
diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py index 87cd6a882..cc1a05852 100644 --- a/module/network/HTTPRequest.py +++ b/module/network/HTTPRequest.py @@ -180,7 +180,7 @@ class HTTPRequest(): self.lastEffectiveURL = self.c.getinfo(pycurl.EFFECTIVE_URL) self.addCookies() - rep = self.decodeResponse(rep) + #rep = self.decodeResponse(rep) return rep def verifyHeader(self): @@ -205,14 +205,19 @@ class HTTPRequest(): for line in header: line = line.lower().replace(" ", "") - if not line.startswith("content-type:") or "charset" not in line or \ + if not line.startswith("content-type:") or \ ("text" not in line and "application" not in line): continue none, delemiter, charset = line.rpartition("charset=") - charset = charset.split(";") - if charset: - encoding = charset[0] + if not delemiter: + encoding = "utf8" + else: + charset = charset.split(";") + if charset: + encoding = charset[0] + else: + encoding = "utf8" if encoding: try: diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index b27b99170..d8bd3bcd0 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -306,8 +306,8 @@ class Plugin(object): res = self.req.load(url, get, post, ref, cookies, just_header) if utf8: - #@TODO parse header and decode automatically when needed - res = decode(res) + res = self.req.http.decodeResponse(res) + #res = decode(res) if self.core.debug: from inspect import currentframe diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 8f8098efb..34f0fa5de 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -16,7 +16,7 @@ class YoutubeCom(Hoster): __author_mail__ = ("spoob@pyload.org") def process(self, pyfile): - html = self.load(pyfile.url) + html = self.load(pyfile.url, utf8=True) if re.search(r"(.*eine fehlerhafte Video-ID\.)", html) is not None: self.offline() @@ -34,7 +34,7 @@ class YoutubeCom(Hoster): if self.getConf("quality") == "hd" or self.getConf("quality") == "hq": file_suffix = ".mp4" - name = (re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix).decode("utf8") + name = (re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix) pyfile.name = name #.replace("&", "&").replace("ö", "oe").replace("ä", "ae").replace("ü", "ue") file_url = "" |