diff options
author | fragonib <devnull@localhost> | 2010-11-27 12:39:17 +0100 |
---|---|---|
committer | fragonib <devnull@localhost> | 2010-11-27 12:39:17 +0100 |
commit | eeb33e7b54e32a46c1530758d0ce7ecd214f1977 (patch) | |
tree | d55ad15654fbbbb12759908c1f73ec2287d04ca6 /module/plugins/hoster | |
parent | Added tag v0.4.3 for changeset 2480b4b44803 (diff) | |
download | pyload-eeb33e7b54e32a46c1530758d0ce7ecd214f1977.tar.xz |
Adds support for filesizes greater than MBs and generalizes unicode fix
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/FileserveCom.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index d53388d91..d247df306 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -14,15 +14,23 @@ def getInfo(urls): result = []
for url in urls:
+
+ # Get html
html = getURL(url)
if re.search(r'<h1>File not available</h1>', html):
result.append((url, 0, 1, url))
continue
- size = re.search(r'<span style="float: left;"><strong>(.*?) MB</strong>', html).group(1)
- size = int(float(size)*1024*1024)
-
+ # Name
name = re.search('<h1>(.*?)<br/></h1>', html).group(1)
+
+ # Size
+ m = re.search(r"<strong>(.*?) (KB|MB|GB)</strong>", html)
+ units = float(m.group(1))
+ pow = {'KB' : 1, 'MB' : 2, 'GB' : 3}[m.group(2)]
+ size = int(units*1024**pow)
+
+ # Return info
result.append((name, size, 2, url))
yield result
@@ -80,11 +88,8 @@ class FileserveCom(Hoster): self.retry()
wait = self.load(self.pyfile.url, post={"downloadLink":"wait"})
- try:
- self.setWait(int(wait)+3)
- except:
- # response looks strange like: wait = '\xef\xbb\xbf35'
- self.setWait(int(wait[-2:]))
+ wait = wait.decode("UTF-8").encode("ascii", "ignore") # Remove unicode stuff
+ self.setWait(int(wait)+3)
self.wait()
# show download link
|