diff options
author | spoob <spoob@gmx.de> | 2009-09-03 16:44:21 +0200 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2009-09-03 16:44:21 +0200 |
commit | aaa0dfd0a5a8843b549e6c1ea66fcb786a8069cf (patch) | |
tree | 89cfe1f1509e116d368578f73797b13608ab878d | |
parent | netload fix (diff) | |
download | pyload-aaa0dfd0a5a8843b549e6c1ea66fcb786a8069cf.tar.xz |
Fixed #24
-rw-r--r-- | Plugins/NetloadIn.py | 3 | ||||
-rwxr-xr-x | module/network/Request.py | 21 |
2 files changed, 19 insertions, 5 deletions
diff --git a/Plugins/NetloadIn.py b/Plugins/NetloadIn.py index 11765f42a..39ea9213e 100644 --- a/Plugins/NetloadIn.py +++ b/Plugins/NetloadIn.py @@ -87,8 +87,7 @@ class NetloadIn(Plugin): file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', self.html[1]).group(1) captcha_image = tempfile.NamedTemporaryFile(suffix=".png").name - - + self.req.download(captcha_url, captcha_image, cookies=True) captcha = self.ocr.get_captcha(captcha_image) self.logger.debug("Captcha %s: %s" % (i, captcha)) diff --git a/module/network/Request.py b/module/network/Request.py index e693afa1d..084c84f95 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -9,10 +9,11 @@ import base64 import cookielib from gzip import GzipFile import time +import re from os import sep, rename from os.path import dirname, exists import urllib - +from base64 import b64decode from cStringIO import StringIO try: @@ -240,11 +241,25 @@ class Request: self.dl = True self.pycurl.perform() + if "..." in file_name: + download_folder = dirname(file_name) + sep + headers = self.get_header() + file_name_search = re.search('filename=(?P<quote>\")?(.+)(?(quote)\")', headers) + if file_name_search: + file_name = file_name_search.group(2) + if "?=" in file_name[-3:]: + file_name = file_name.replace("=?UTF-8?B?", "").replace("?=", "==") + file_name = b64decode(file_name) + file_name = download_folder + sep + file_name + file_count = 0 while exists(file_name): file_count += 1 - file_split = file_name.split(".") - temp_name = "%s-%i.%s" % (file_split[0], file_count, file_split[1]) + if "." in file_name: + file_split = file_name.split(".") + temp_name = "%s-%i.%s" % (".".join(file_split[:-1]), file_count, file_split[-1]) + else: + temp_name = "%s-%i" % (file_name, file_count) if not exists(temp_name): file_name = temp_name |