summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-08-09 04:48:35 +0200
committerGravatar spoob <spoob@gmx.de> 2009-08-09 04:48:35 +0200
commit69ec3ccdee225f1b8e00542b1dee737a51bdc18b (patch)
treec1cc43401eb481ec5fed5ddc228a7f7e1f8d59da
parentpyloadCli local switch fix (diff)
downloadpyload-69ec3ccdee225f1b8e00542b1dee737a51bdc18b.tar.xz
fixed megaupload bug
-rw-r--r--Plugins/MegauploadCom.py10
-rw-r--r--Plugins/Plugin.py1
-rw-r--r--module/file_list.py1
-rwxr-xr-xmodule/network/Request.py38
-rw-r--r--module/thread_list.py3
5 files changed, 27 insertions, 26 deletions
diff --git a/Plugins/MegauploadCom.py b/Plugins/MegauploadCom.py
index 63f033945..bcafec83f 100644
--- a/Plugins/MegauploadCom.py
+++ b/Plugins/MegauploadCom.py
@@ -60,8 +60,8 @@ class MegauploadCom(Plugin):
if self.html[0] == None:
self.download_html()
if not self.want_reconnect:
- file_name_pattern = '<font style="font-family:arial; color:#FF6700; font-size:22px; font-weight:bold;">(.*)</font><br>'
- return re.search(file_name_pattern, self.html[0]).group(1)
+ file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="'
+ return re.search(file_name_pattern, self.html[1]).group(1).split("/")[-1]
else:
return self.parent.url
@@ -70,10 +70,8 @@ class MegauploadCom(Plugin):
"""
if self.html[0] == None:
self.download_html()
- if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) != None:
+ if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) != None or \
+ re.search(r"Download limit exceeded", self.html[0]):
return False
else:
return True
-
- def proceed(self, url, location):
- self.req.download(url, location, cookies=True)
diff --git a/Plugins/Plugin.py b/Plugins/Plugin.py
index 5d7fc8f45..0ff11ecb5 100644
--- a/Plugins/Plugin.py
+++ b/Plugins/Plugin.py
@@ -62,7 +62,6 @@ class Plugin():
pyfile.status.url = self.get_file_url()
pyfile.status.want_reconnect = self.want_reconnect
-
thread.wait(self.parent)
return True
diff --git a/module/file_list.py b/module/file_list.py
index 7eaca7c97..4b3577bfc 100644
--- a/module/file_list.py
+++ b/module/file_list.py
@@ -102,7 +102,6 @@ class File_List(object):
self.files.insert(index + offset, pyfile)
break
-
index = self.data['order'].index(id)
pyfile = self.data['order'].pop(index)
self.data['order'].insert(index + offset, pyfile)
diff --git a/module/network/Request.py b/module/network/Request.py
index 30ffbcd3e..8e3ece456 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -9,6 +9,7 @@ import base64
import cookielib
import time
import urllib
+from urllib2 import URLError, HTTPError
import urllib2
from gzip import GzipFile
@@ -146,22 +147,27 @@ class Request:
if not self.dl:
self.dl = True
file = open(filename, 'wb')
- conn = self.downloader.open(req, post)
- if conn.headers.has_key("content-length"):
- self.dl_size = int(conn.headers["content-length"])
- else:
- self.dl_size = 0
- self.dl_arrived = 0
- self.dl_time = time.time()
- for chunk in conn:
- if self.abort: raise AbortDownload
- self.dl_arrived += len(chunk)
- file.write(chunk)
-
- file.close()
- self.dl = False
- self.dl_finished = time.time()
- return True
+ try:
+ conn = self.downloader.open(req, post)
+ if conn.headers.has_key("content-length"):
+ self.dl_size = int(conn.headers["content-length"])
+ else:
+ self.dl_size = 0
+ self.dl_arrived = 0
+ self.dl_time = time.time()
+ for chunk in conn:
+ if self.abort: raise AbortDownload
+ self.dl_arrived += len(chunk)
+ file.write(chunk)
+
+ file.close()
+ self.dl = False
+ self.dl_finished = time.time()
+ return True
+ except HTTPError, e:
+ print e
+ except URLError, e:
+ print e
def get_speed(self):
try:
diff --git a/module/thread_list.py b/module/thread_list.py
index cf3df9f94..c578ac752 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -63,7 +63,6 @@ class Thread_List(object):
if not self.parent.is_dltime() or self.pause or self.reconnecting or not self.list.files: #conditions when threads dont download
return None
-
self.init_reconnect()
self.lock.acquire()
@@ -105,7 +104,7 @@ class Thread_List(object):
self.list.files.insert(0, pyfile)
elif pyfile.status.type == "failed":
- self.parent.logger.warning("Download failed: " + pyfile.url+" | "+ pyfile.status.error)
+ self.parent.logger.warning("Download failed: " + pyfile.url+ " | " + pyfile.status.error)
with open(self.parent.config['failed_file'], 'a') as f:
f.write(pyfile.url + "\n")
self.list.remove(pyfile)