From a4f5e00338353e9795cb27d6c4f21fb8a75b0d4f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Oct 2014 12:43:02 +0200 Subject: [Keep2shareCC] Fix handleCaptcha --- module/plugins/hoster/Keep2shareCC.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 26a50bb61..a56ac36da 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2shareCC(SimpleHoster): __name__ = "Keep2shareCC" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' @@ -71,19 +71,23 @@ class Keep2shareCC(SimpleHoster): def handleCaptcha(self): - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m is None: - self.error("Captcha key not found") - - captcha_url = urljoin(self.base_url, m.group(1)) + recaptcha = ReCaptcha(self) for _ in xrange(5): - post_data = {'CaptchaForm[code]': self.decryptCaptcha(captcha_url), - 'free': 1, + post_data = {'free': 1, 'freeDownloadRequest': 1, 'uniqueId': self.fid, 'yt0': ''} + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + captcha_url = urljoin(self.base_url, m.group(1)) + post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) + else: + challenge, response = recaptcha.challenge() + post_data.update({'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response}) + self.html = self.load(self.pyfile.url, post=post_data) if 'recaptcha' not in self.html: -- cgit v1.2.3