From 57d14a22edf217164ce1857f5bd69f1d580bb8a4 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Fri, 11 Nov 2011 20:43:07 +0100 Subject: update HellShare.Cz - support split archives --- module/plugins/hoster/HellshareCz.py | 28 +++++++++++++++------------- 1 file 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'Size\s*([0-9.]*) (kB|KB|MB|GB)' FILE_OFFLINE_PATTERN = r'

File not found.

' CAPTCHA_PATTERN = r'' - FILE_CREDITS_PATTERN = r'(\d+) MB' + #FILE_CREDITS_PATTERN = r'(\d+) MB' CREDIT_LEFT_PATTERN = r'

After downloading this file you will have (\d+) MB for future downloads.' DOWNLOAD_AGAIN_PATTERN = r'

This file you downloaded already and re-download is for free.

' @@ -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) -- cgit v1.2.3