summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/CrockoCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/CrockoCom.py')
-rw-r--r--module/plugins/hoster/CrockoCom.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py
index 3cd2be59d..80d9b3d61 100644
--- a/module/plugins/hoster/CrockoCom.py
+++ b/module/plugins/hoster/CrockoCom.py
@@ -2,23 +2,25 @@
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class CrockoCom(SimpleHoster):
__name__ = "CrockoCom"
__type__ = "hoster"
- __pattern__ = r'http://(?:www\.)?(crocko|easy-share).com/\w+'
__version__ = "0.16"
+
+ __pattern__ = r'http://(?:www\.)?(crocko|easy-share).com/\w+'
+
__description__ = """Crocko hoster plugin"""
__author_name__ = "zoidberg"
__author_mail__ = "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>'
- FILE_OFFLINE_PATTERN = r"<h1>Sorry,<br />the page you're looking for <br />isn't here.</h1>|File not found"
- DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';"
+ 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_KEY_PATTERN = re.compile(r'Recaptcha.create\("([^"]+)"')
@@ -27,28 +29,29 @@ class CrockoCom(SimpleHoster):
FILE_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.")
for _ in xrange(5):
- found = re.search(self.CAPTCHA_URL_PATTERN, self.html)
- if found:
- url, wait_time = 'http://crocko.com' + found.group(1), found.group(2)
+ m = re.search(self.CAPTCHA_URL_PATTERN, self.html)
+ if m:
+ url, wait_time = 'http://crocko.com' + m.group(1), m.group(2)
self.wait(wait_time)
self.html = self.load(url)
else:
break
- found = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
- if not found:
+ m = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
+ if m is None:
self.parseError('Captcha KEY')
- captcha_key = found.group(1)
+ captcha_key = m.group(1)
- found = re.search(self.FORM_PATTERN, self.html, re.DOTALL)
- if not found:
+ m = re.search(self.FORM_PATTERN, self.html, re.DOTALL)
+ if m is None:
self.parseError('ACTION')
- action, form = found.groups()
+ action, form = m.groups()
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
recaptcha = ReCaptcha(self)