summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-11 20:43:07 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-11 20:43:07 +0100
commit57d14a22edf217164ce1857f5bd69f1d580bb8a4 (patch)
tree7358048b135f482321c66e9819698b33a5e51c68
parentoption for subfolders (diff)
downloadpyload-57d14a22edf217164ce1857f5bd69f1d580bb8a4.tar.xz
update HellShare.Cz - support split archives
-rw-r--r--module/plugins/hoster/HellshareCz.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py
index 8c90e8099..c067dc40d 100644
--- a/module/plugins/hoster/HellshareCz.py
+++ b/module/plugins/hoster/HellshareCz.py
@@ -18,6 +18,7 @@
import re
import datetime
+from math import ceil
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
@@ -47,8 +48,8 @@ def getInfo(urls):
class HellshareCz(Hoster):
__name__ = "HellshareCz"
__type__ = "hoster"
- __pattern__ = r"http://(.*\.)*hellshare\.(cz|com|sk|hu)/.*"
- __version__ = "0.71"
+ __pattern__ = r"http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu)/[^?]*/(\d+).*"
+ __version__ = "0.73"
__description__ = """Hellshare.cz"""
__author_name__ = ("zoidberg")
@@ -58,7 +59,7 @@ class HellshareCz(Hoster):
FILE_SIZE_PATTERN = r'<td><span>Size</span></td>\s*<th><span>([0-9.]*)&nbsp;(kB|KB|MB|GB)</span></th>'
FILE_OFFLINE_PATTERN = r'<h1>File not found.</h1>'
CAPTCHA_PATTERN = r'<img class="left" id="captcha-img"src="([^"]*)" />'
- FILE_CREDITS_PATTERN = r'<strong class="filesize">(\d+) MB</strong>'
+ #FILE_CREDITS_PATTERN = r'<strong class="filesize">(\d+) MB</strong>'
CREDIT_LEFT_PATTERN = r'<p>After downloading this file you will have (\d+) MB for future downloads.'
DOWNLOAD_AGAIN_PATTERN = r'<p>This file you downloaded already and re-download is for free. </p>'
@@ -71,9 +72,16 @@ class HellshareCz(Hoster):
self.account.relogin(self.user)
pyfile.url = re.search(r'([^?]*)', pyfile.url).group(1)
- self.html = self.load(pyfile.url, get = {"do" : "fileDownloadButton-showDownloadWindow"}, decode=True)
+ self.html = self.load(pyfile.url, decode = True)
self.getFileInfo(pyfile)
+ if "do=relatedFileDownloadButton" in self.html:
+ found = re.search(self.__pattern__, self.pyfile.url)
+ show_window = "relatedFileDownloadButton-%s-showDownloadWindow" % found.group(1)
+ else:
+ show_window = "fileDownloadButton-showDownloadWindow"
+ self.html = self.load(pyfile.url, get = {"do" : show_window}, decode=True)
+
if self.account:
self.handlePremium()
else:
@@ -141,18 +149,12 @@ class HellshareCz(Hoster):
else:
found = re.search(self.CREDIT_LEFT_PATTERN, self.html)
if not found:
- self.fail("Not enough credit left. Trying to download as free user.")
+ self.logError("Not enough credit left: %d (%d needed). Trying to download as free user." % (credits_left, file_credits))
self.resetAccount()
credits_left = int(found.group(1))
- found = re.search(self.FILE_CREDITS_PATTERN, self.html)
- if found:
- self.file_credits = found.group(1)
- else:
- self.logError("Parse error: file credits")
- self.file_credits = "???"
-
- self.logInfo("Downloading file for %s credits, %d credits left" % (self.file_credits, credits_left))
+ file_credits = ceil(self.pyfile.size / 1024 ** 2)
+ self.logInfo("Downloading file for %d credits, %d credits left" % (file_credits, credits_left))
self.download(download_url)