diff options
Diffstat (limited to 'module/plugins/hoster/FreakshareCom.py')
-rw-r--r-- | module/plugins/hoster/FreakshareCom.py | 22 |
1 files changed, 20 insertions, 2 deletions
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
|