# -*- coding: utf-8 -*- import re import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" __version__ = "0.24" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' __config__ = [("activated" , "bool", "Activated" , True), ("use_premium", "bool", "Use premium account if available", True)] __description__ = """Crocko hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] NAME_PATTERN = r'Download:\s*(?P.*)' SIZE_PATTERN = r'(?P[^<]+)' OFFLINE_PATTERN = r'

Sorry,
the page you\'re looking for
isn\'t here.

|File not found' CAPTCHA_PATTERN = r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';" FORM_PATTERN = r'
(.*?)
' FORM_INPUT_PATTERN = r']* name="?([^" ]+)"? value="?([^" ]+)"?.*?>' NAME_REPLACEMENTS = [(r'<.*?>', '')] def handle_free(self, pyfile): if "You need Premium membership to download this file." in self.data: self.fail(_("You need Premium membership to download this file")) for _i in xrange(5): m = re.search(self.CAPTCHA_PATTERN, self.data) if m is not None: url = urlparse.urljoin("http://crocko.com/", m.group(1)) self.wait(m.group(2)) self.data = self.load(url) else: break m = re.search(self.FORM_PATTERN, self.data, re.S) if m is None: self.error(_("FORM_PATTERN not found")) action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) recaptcha = ReCaptcha(self) inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) if self.check_file({'captcha': recaptcha.KEY_AJAX_PATTERN}): self.retry_captcha() getInfo = create_getInfo(CrockoCom)