summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/hoster/CrockoCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/hoster/CrockoCom.py')
-rw-r--r--pyload/plugins/hoster/CrockoCom.py44
1 files changed, 21 insertions, 23 deletions
diff --git a/pyload/plugins/hoster/CrockoCom.py b/pyload/plugins/hoster/CrockoCom.py
index 81566e10c..012fb7f0b 100644
--- a/pyload/plugins/hoster/CrockoCom.py
+++ b/pyload/plugins/hoster/CrockoCom.py
@@ -7,34 +7,35 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class CrockoCom(SimpleHoster):
- __name__ = "CrockoCom"
- __type__ = "hoster"
- __version__ = "0.16"
+ __name__ = "CrockoCom"
+ __type__ = "hoster"
+ __version__ = "0.17"
- __pattern__ = r'http://(?:www\.)?(crocko|easy-share).com/\w+'
+ __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+'
__description__ = """Crocko hoster plugin"""
- __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
+ __license__ = "GPLv3"
+ __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- FILE_NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)'
- FILE_SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>'
- OFFLINE_PATTERN = r"<h1>Sorry,<br />the page you're looking for <br />isn't here.</h1>|File not found"
+ NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)'
+ SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>'
+ OFFLINE_PATTERN = r'<h1>Sorry,<br />the page you\'re looking for <br />isn\'t here.</h1>|File not found'
- CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
+ CAPTCHA_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>'
FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>'
- FILE_NAME_REPLACEMENTS = [(r'<[^>]*>', '')]
+ NAME_REPLACEMENTS = [(r'<[^>]*>', '')]
def handleFree(self):
if "You need Premium membership to download this file." in self.html:
- self.fail("You need Premium membership to download this file.")
+ self.fail(_("You need Premium membership to download this file"))
- for _ in xrange(5):
- m = re.search(self.CAPTCHA_URL_PATTERN, self.html)
+ for _i in xrange(5):
+ m = re.search(self.CAPTCHA_PATTERN, self.html)
if m:
url, wait_time = 'http://crocko.com' + m.group(1), m.group(2)
self.wait(wait_time)
@@ -42,19 +43,16 @@ class CrockoCom(SimpleHoster):
else:
break
- recaptcha = ReCaptcha(self)
- captcha_key = recaptcha.detect_key()
- if captcha_key is None:
- self.parseError("ReCaptcha captcha key not found")
-
- m = re.search(self.FORM_PATTERN, self.html, re.DOTALL)
+ m = re.search(self.FORM_PATTERN, self.html, re.S)
if m is None:
- self.parseError('ACTION')
+ self.error(_("FORM_PATTERN not found"))
+
action, form = m.groups()
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
+ recaptcha = ReCaptcha(self)
- for _ in xrange(5):
- inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
+ for _i in xrange(5):
+ inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge()
self.download(action, post=inputs)
check = self.checkDownload({
@@ -66,7 +64,7 @@ class CrockoCom(SimpleHoster):
else:
break
else:
- self.fail('No valid captcha solution received')
+ self.fail(_("No valid captcha solution received"))
getInfo = create_getInfo(CrockoCom)