summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/CzshareCom.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-22 20:50:34 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-22 20:50:34 +0200
commit2edeee0532ec6d6b4b26fd045a5971f67ca455da (patch)
tree8d656afc9c18f7dba7c05d6635f898fdf58d66d6 /module/plugins/hoster/CzshareCom.py
parentFixed PEP 8 violations in Crypters (diff)
downloadpyload-2edeee0532ec6d6b4b26fd045a5971f67ca455da.tar.xz
Fixed PEP 8 violations in Hosters
Diffstat (limited to 'module/plugins/hoster/CzshareCom.py')
-rw-r--r--module/plugins/hoster/CzshareCom.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index 347427586..8f6f76d84 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -23,6 +23,7 @@ import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
from module.utils import parseFileSize
+
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
@@ -34,7 +35,7 @@ class CzshareCom(SimpleHoster):
FILE_NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>'
FILE_SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B\s*</div>'
FILE_OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">'
-
+
FILE_SIZE_REPLACEMENTS = [(' ', '')]
FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://czshare.com/\1/x/')]
SH_CHECK_TRAFFIC = True
@@ -57,11 +58,12 @@ class CzshareCom(SimpleHoster):
self.account.relogin(self.user)
self.html = self.load(self.pyfile.url, cookies=True, decode=True)
found = re.search(self.USER_CREDIT_PATTERN, self.html)
- if not found: return False
+ if not found:
+ return False
# check user credit
try:
- credit = parseFileSize(found.group(1).replace(' ',''), found.group(2))
+ credit = parseFileSize(found.group(1).replace(' ', ''), found.group(2))
self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024))
self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024))
if credit < self.pyfile.size:
@@ -70,11 +72,11 @@ class CzshareCom(SimpleHoster):
except Exception, e:
# let's continue and see what happens...
self.logError('Parse error (CREDIT): %s' % e)
-
- return True
-
- def handlePremium(self):
- # parse download link
+
+ return True
+
+ def handlePremium(self):
+ # parse download link
try:
form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.DOTALL).group(1)
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
@@ -121,20 +123,20 @@ class CzshareCom(SimpleHoster):
break
else:
self.fail("No valid captcha code entered")
-
+
found = re.search("countdown_number = (\d+);", self.html)
self.setWait(int(found.group(1)) if found else 50)
# download the file, destination is determined by pyLoad
- self.logDebug("WAIT URL", self.req.lastEffectiveURL)
- found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL)
+ self.logDebug("WAIT URL", self.req.lastEffectiveURL)
+ found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL)
if not found:
raise PluginParseError('Download URL')
url = "http://%s/download.php?%s" % (found.group(1), found.group(2))
-
- self.wait()
- self.multiDL = True
+
+ self.wait()
+ self.multiDL = True
self.download(url)
self.checkDownloadedFile()
@@ -145,7 +147,7 @@ class CzshareCom(SimpleHoster):
"credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"),
"multi_dl": re.compile(self.MULTIDL_PATTERN),
"captcha_err": "<li>Zadaný ověřovací kód nesouhlasí!</li>"
- })
+ })
if check == "tempoffline":
self.fail("File not available - try later")
@@ -156,5 +158,6 @@ class CzshareCom(SimpleHoster):
elif check == "captcha_err":
self.invalidCaptcha()
self.retry()
-
+
+
getInfo = create_getInfo(CzshareCom)