diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-23 12:43:02 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-23 12:43:02 +0200 |
commit | a4f5e00338353e9795cb27d6c4f21fb8a75b0d4f (patch) | |
tree | a25a640abfe8a0a028a786fde2de9bcf27cce6fc /module | |
parent | Simplify captcha challenge calls (diff) | |
download | pyload-a4f5e00338353e9795cb27d6c4f21fb8a75b0d4f.tar.xz |
[Keep2shareCC] Fix handleCaptcha
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/Keep2shareCC.py | 20 |
1 files changed, 12 insertions, 8 deletions
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<ID>\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: |