summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-13 20:19:23 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-13 20:19:23 +0200
commit67db64c7c8c1813a4e22ed819846a69c6abefc2e (patch)
treeb01c50f408ad05440bec6e0f52df0b5196d4e3d7 /module/plugins
parentbetter retry function (diff)
downloadpyload-67db64c7c8c1813a4e22ed819846a69c6abefc2e.tar.xz
erniebs patches
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hoster/EasyShareCom.py4
-rw-r--r--module/plugins/hoster/FreakshareCom.py22
-rw-r--r--module/plugins/hoster/HotfileCom.py11
-rw-r--r--module/plugins/hoster/MegauploadCom.py5
4 files changed, 34 insertions, 8 deletions
diff --git a/module/plugins/hoster/EasyShareCom.py b/module/plugins/hoster/EasyShareCom.py
index b389c5262..542b4367f 100644
--- a/module/plugins/hoster/EasyShareCom.py
+++ b/module/plugins/hoster/EasyShareCom.py
@@ -24,11 +24,11 @@ class EasyShareCom(Hoster):
self.html = self.load(self.pyfile.url)
if re.search("Die von ihnen angeforderte Datei wurde gel\xc3\xb6scht.", self.html):
- self.offline();
+ self.offline()
self.pyfile.name = self.getFileName()
- self.download( self.getFileUrl() )
+ self.download(self.getFileUrl())
def getFileName(self):
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index d795147a6..c20206bf5 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -49,6 +49,7 @@ class FreakshareCom(Hoster):
self.setWait( self.get_waiting_time() )
pyfile.name = self.get_file_name()
+ pyfile.size = self.get_file_size()
self.wait()
@@ -73,11 +74,28 @@ class FreakshareCom(Hoster):
if self.html is None:
self.download_html()
if not self.wantReconnect:
- file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center\;\">([^ ]+)", self.html).group(1)
+ file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html)
+ if file_name is not None:
+ file_name = file_name.group(1)
+ else:
+ file_name = self.pyfile.url
return file_name
else:
return self.pyfile.url
+ def get_file_size(self):
+ size = 0
+ if self.html is None:
+ self.download_html()
+ if not self.wantReconnect:
+ file_size_check = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html)
+ if file_size_check is not None:
+ units = float(file_size_check.group(1).replace(",", ""))
+ pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)]
+ size = int(units * 1024 ** pow)
+
+ return size
+
def get_waiting_time(self):
if self.html is None:
self.download_html()
@@ -140,4 +158,4 @@ class FreakshareCom(Hoster):
request_options.append(("recaptcha_challenge_field", challenge))
request_options.append(("recaptcha_response_field", result))
- return request_options \ No newline at end of file
+ return request_options
diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py
index 75806fe4e..2da443e29 100644
--- a/module/plugins/hoster/HotfileCom.py
+++ b/module/plugins/hoster/HotfileCom.py
@@ -86,14 +86,19 @@ class HotfileCom(Hoster):
self.download(dl)
def downloadHTML(self):
- self.html[0] = self.load(self.pyfile.url, get={"lang":"en"}, cookies=True)
+ self.html[0] = self.load(self.pyfile.url, get={"lang":"en"})
def freeDownload(self):
- form_content = re.search(r"<form style=.*(\n<.*>\s*)*?\n<tr>", self.html[0]).group(0)
+ form_content = re.search(r"<form style=.*(\n<.*>\s*)*?[\n\t]?<tr>", self.html[0])
+ if form_content is None:
+ print self.html[0]
+ self.fail("Form not found in HTML. Can not proceed.")
+
+ form_content = form_content.group(0)
form_posts = re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content)
- self.html[1] = self.load(self.pyfile.url, post=form_posts, cookies=True)
+ self.html[1] = self.load(self.pyfile.url, post=form_posts)
challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", self.html[1])
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py
index 5e03ce3aa..fa16fdf31 100644
--- a/module/plugins/hoster/MegauploadCom.py
+++ b/module/plugins/hoster/MegauploadCom.py
@@ -99,7 +99,10 @@ class MegauploadCom(Hoster):
self.wait()
pyfile.name = self.get_file_name()
- self.download(self.get_file_url())
+ url = self.get_file_url()
+ if url is None:
+ return self.fail("URL could not be retrieved")
+ self.download( url )
check = self.checkDownload({"limit": "Download limit exceeded"})
if check == "limit":