summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/CzshareCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/CzshareCom.py')
-rw-r--r--module/plugins/hoster/CzshareCom.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index aa381d712..fb9e7f457 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -12,7 +12,7 @@ from module.utils import parseFileSize
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
- __version__ = "0.96"
+ __version__ = "0.97"
__pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+'
@@ -63,7 +63,7 @@ class CzshareCom(SimpleHoster):
return True
- def handlePremium(self):
+ def handlePremium(self, pyfile):
# parse download link
try:
form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1)
@@ -77,12 +77,14 @@ class CzshareCom(SimpleHoster):
self.checkDownloadedFile()
- def handleFree(self):
+ def handleFree(self, pyfile):
# get free url
m = re.search(self.FREE_URL_PATTERN, self.html)
if m is None:
self.error(_("FREE_URL_PATTERN not found"))
+
parsed_url = "http://sdilej.cz" + m.group(1)
+
self.logDebug("PARSED_URL:" + parsed_url)
# get download ticket and parse html
@@ -93,7 +95,8 @@ class CzshareCom(SimpleHoster):
try:
form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1)
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
- self.pyfile.size = int(inputs['size'])
+ pyfile.size = int(inputs['size'])
+
except Exception, e:
self.logError(e)
self.error(_("Form"))
@@ -103,10 +106,13 @@ class CzshareCom(SimpleHoster):
for _i in xrange(5):
inputs['captchastring2'] = self.decryptCaptcha(captcha_url)
self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True)
+
if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html:
self.invalidCaptcha()
+
elif re.search(self.MULTIDL_PATTERN, self.html):
self.longWait(5 * 60, 12)
+
else:
self.correctCaptcha()
break
@@ -118,6 +124,7 @@ class CzshareCom(SimpleHoster):
# download the file, destination is determined by pyLoad
self.logDebug("WAIT URL", self.req.lastEffectiveURL)
+
m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL)
if m is None:
self.error(_("Download URL not found"))
@@ -132,19 +139,22 @@ class CzshareCom(SimpleHoster):
def checkDownloadedFile(self):
# check download
check = self.checkDownload({
- "temp_offline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"),
- "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>"
+ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"),
+ "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"),
+ "multi-dl" : re.compile(self.MULTIDL_PATTERN),
+ "captcha" : "<li>Zadaný ověřovací kód nesouhlasí!</li>"
})
- if check == "temp_offline":
+ if check == "temp offline":
self.fail(_("File not available - try later"))
- if check == "credit":
+
+ elif check == "credit":
self.resetAccount()
- elif check == "multi_dl":
+
+ elif check == "multi-dl":
self.longWait(5 * 60, 12)
- elif check == "captcha_err":
+
+ elif check == "captcha":
self.invalidCaptcha()
self.retry()