From 027cb529d79558de19c47da88a782b31745a65c9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 21 Jul 2015 22:53:37 +0200 Subject: New Captcha skeleton --- module/plugins/hoster/BezvadataCz.py | 17 ++++------------- module/plugins/hoster/BitshareCom.py | 4 ++-- module/plugins/hoster/CrockoCom.py | 2 +- module/plugins/hoster/CzshareCom.py | 8 ++++---- module/plugins/hoster/ExtabitCom.py | 4 ++-- module/plugins/hoster/FastshareCz.py | 2 +- module/plugins/hoster/FileSharkPl.py | 13 ++----------- module/plugins/hoster/FileboomMe.py | 6 +++--- module/plugins/hoster/FilecloudIo.py | 4 ++-- module/plugins/hoster/FiledropperCom.py | 2 +- module/plugins/hoster/FilerNet.py | 4 ++-- module/plugins/hoster/FileserveCom.py | 4 ++-- module/plugins/hoster/FreakshareCom.py | 2 +- module/plugins/hoster/GigapetaCom.py | 4 ++-- module/plugins/hoster/IfolderRu.py | 4 ++-- module/plugins/hoster/Keep2ShareCc.py | 6 +++--- module/plugins/hoster/LetitbitNet.py | 4 ++-- module/plugins/hoster/LuckyShareNet.py | 4 ++-- module/plugins/hoster/MegasharesCom.py | 6 +++--- module/plugins/hoster/NarodRu.py | 6 +++--- module/plugins/hoster/OboomCom.py | 8 ++++---- module/plugins/hoster/RapidgatorNet.py | 4 ++-- module/plugins/hoster/SendspaceCom.py | 6 +++--- module/plugins/hoster/ShareonlineBiz.py | 10 +++++----- module/plugins/hoster/TurbobitNet.py | 6 +++--- module/plugins/hoster/UlozTo.py | 6 +++--- module/plugins/hoster/UloziskoSk.py | 2 +- module/plugins/hoster/UnibytesCom.py | 6 +++--- module/plugins/hoster/UploadheroCom.py | 2 +- 29 files changed, 69 insertions(+), 87 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index be705d528..523e87541 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __status__ = "stable" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' @@ -48,17 +48,12 @@ class BezvadataCz(SimpleHoster): if m is None: self.error(_("Wrong captcha image")) - #: Captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url - self.load, proper_load = self.loadcaptcha, self.load - try: - inputs['captcha'] = self.decrypt_captcha(m.group(1), imgtype='png') - finally: - self.load = proper_load + inputs['captcha'] = self.captcha.decrypt(m.group(1).decode('base64'), input_type='png') if 'Zadaný ověřovací kód nesouhlasí!" in self.html: - self.invalid_captcha() + self.captcha.invalid() elif re.search(self.MULTIDL_PATTERN, self.html): self.wait(5 * 60, 12, _("Download limit reached")) else: - self.correct_captcha() + self.captcha.correct() break else: self.fail(_("No valid captcha code entered")) @@ -154,7 +154,7 @@ class CzshareCom(SimpleHoster): self.wait(5 * 60, 12, _("Download limit reached")) elif check == "captcha": - self.invalid_captcha() + self.captcha.invalid() self.retry() return super(CzshareCom, self).checkFile() diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 73633fd50..3b0367467 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -55,10 +55,10 @@ class ExtabitCom(SimpleHoster): get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in res: - self.correct_captcha() + self.captcha.correct() break else: - self.invalid_captcha() + self.captcha.invalid() else: self.fail(_("Invalid captcha")) else: diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index b18a937bc..abe2ef2d6 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -55,7 +55,7 @@ class FastshareCz(SimpleHoster): self.error(_("FREE_URL_PATTERN not found")) baseurl = "http://www.fastshare.cz" - captcha = self.decrypt_captcha(urlparse.urljoin(baseurl, captcha_src)) + captcha = self.captcha.decrypt_image(urlparse.urljoin(baseurl, captcha_src)) self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 2f6898f15..901890433 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "stable" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' @@ -100,19 +100,10 @@ class FileSharkPl(SimpleHoster): if m is None: self.retry(reason=_("Captcha image not found")) - tmp_load = self.load - self.load = self._decode64 #: work-around: injects decode64 inside decryptCaptcha - - inputs['form[captcha]'] = self.decrypt_captcha(m.group(1), imgtype='jpeg') + inputs['form[captcha]'] = self.captcha.decrypt(m.group(1).decode('base64'), input_type='jpeg') inputs['form[start]'] = "" - self.load = tmp_load - self.download(link, post=inputs, disposition=True) - def _decode64(self, data, *args, **kwargs): - return data.decode('base64') - - getInfo = create_getInfo(FileSharkPl) diff --git a/module/plugins/hoster/FileboomMe.py b/module/plugins/hoster/FileboomMe.py index 97414cbf1..8d0f5d89c 100644 --- a/module/plugins/hoster/FileboomMe.py +++ b/module/plugins/hoster/FileboomMe.py @@ -56,7 +56,7 @@ class FileboomMe(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.html) if m: - captcha = self.decrypt_captcha(urljoin(pyfile.url, m.group(1))) + captcha = self.captcha.decrypt_image(urljoin(pyfile.url, m.group(1))) self.html = self.load(post_url, post={'CaptchaForm[code]' : captcha, @@ -65,7 +65,7 @@ class FileboomMe(SimpleHoster): 'uniqueId' : uniqueId}) if 'The verification code is incorrect' in self.html: - self.invalid_captcha() + self.captcha.invalid() else: self.check_errors() @@ -79,7 +79,7 @@ class FileboomMe(SimpleHoster): self.link = urljoin(pyfile.url, m.group(0)) else: - self.invalid_captcha() + self.captcha.invalid() break diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 67e5c1053..d010af624 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -88,9 +88,9 @@ class FilecloudIo(SimpleHoster): res = json_loads(res) if "retry" in res and res['retry']: - self.invalid_captcha() + self.captcha.invalid() else: - self.correct_captcha() + self.captcha.correct() break else: self.fail(_("Incorrect captcha")) diff --git a/module/plugins/hoster/FiledropperCom.py b/module/plugins/hoster/FiledropperCom.py index b508c2734..dede02dac 100644 --- a/module/plugins/hoster/FiledropperCom.py +++ b/module/plugins/hoster/FiledropperCom.py @@ -34,7 +34,7 @@ class FiledropperCom(SimpleHoster): if m is None: self.fail("Captcha not found") - captcha_code = self.decrypt_captcha("http://www.filedropper.com/%s" % m.group(1)) + captcha_code = self.captcha.decrypt_image("http://www.filedropper.com/%s" % m.group(1)) m = re.search(r'method="post" action="(.+?)"', self.html) if m is None: diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index bed686a49..61b3a9635 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -59,9 +59,9 @@ class FilerNet(SimpleHoster): if 'location' in self.req.http.header.lower(): self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) - self.correct_captcha() + self.captcha.correct() else: - self.invalid_captcha() + self.captcha.invalid() getInfo = create_getInfo(FilerNet) diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 6f796ca69..117ee1f4c 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -167,9 +167,9 @@ class FileserveCom(Hoster): 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.file_id})) if not res['success']: - self.invalid_captcha() + self.captcha.invalid() else: - self.correct_captcha() + self.captcha.correct() break else: self.fail(_("Invalid captcha")) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 929baba66..ba088027a 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -61,7 +61,7 @@ class FreakshareCom(Hoster): self.fail(_("File not downloadable")) elif check == "wrong_captcha": - self.invalid_captcha() + self.captcha.invalid() self.retry() elif check == "downloadserver": diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index e4562be59..3fcf4ee32 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -39,7 +39,7 @@ class GigapetaCom(SimpleHoster): for _i in xrange(5): self.check_errors() - captcha = self.decrypt_captcha(captcha_url) + captcha = self.captcha.decrypt_image(captcha_url) self.html = self.load(pyfile.url, post={ 'captcha_key': captcha_key, 'captcha': captcha, @@ -50,7 +50,7 @@ class GigapetaCom(SimpleHoster): self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 break elif "Entered figures don`t coincide with the picture" in self.html: - self.invalid_captcha() + self.captcha.invalid() else: self.fail(_("No valid captcha code entered")) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 5cd2c6618..457bd6962 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -49,13 +49,13 @@ class IfolderRu(SimpleHoster): captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id for _i in xrange(5): action, inputs = self.parse_html_form('id="download-step-one-form"') - inputs['confirmed_number'] = self.decrypt_captcha(captcha_url, cookies=True) + inputs['confirmed_number'] = self.captcha.decrypt_image(captcha_url, cookies=True) inputs['action'] = '1' self.log_debug(inputs) self.html = self.load(url, post=inputs) if self.WRONG_CAPTCHA_PATTERN in self.html: - self.invalid_captcha() + self.captcha.invalid() else: break else: diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index a4faa72d0..4fa3f121f 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -101,7 +101,7 @@ class Keep2ShareCc(SimpleHoster): self.log_debug("CAPTCHA_PATTERN found %s" % m) if m: captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) - post_data['CaptchaForm[code]'] = self.decrypt_captcha(captcha_url) + post_data['CaptchaForm[code]'] = self.captcha.decrypt_image(captcha_url) else: recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() @@ -111,9 +111,9 @@ class Keep2ShareCc(SimpleHoster): self.html = self.load(self.pyfile.url, post=post_data) if 'verification code is incorrect' not in self.html: - self.correct_captcha() + self.captcha.correct() else: - self.invalid_captcha() + self.captcha.invalid() getInfo = create_getInfo(Keep2ShareCc) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 63c57c9a5..92bb5ab62 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -100,14 +100,14 @@ class LetitbitNet(SimpleHoster): self.log_debug(res) if not res: - self.invalid_captcha() + self.captcha.invalid() if res == "error_free_download_blocked": self.log_warning(_("Daily limit reached")) self.wait(seconds_to_midnight(gmt=2), True) if res == "error_wrong_captcha": - self.invalid_captcha() + self.captcha.invalid() self.retry() elif res.startswith('['): diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index ab07cd11e..e5ae3f1c3 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -59,10 +59,10 @@ class LuckyShareNet(SimpleHoster): self.log_debug("JSON: " + rep) if 'link' in rep: json.update(self.parse_json(rep)) - self.correct_captcha() + self.captcha.correct() break elif 'Verification failed' in rep: - self.invalid_captcha() + self.captcha.invalid() else: self.error(_("Unable to get downlaod link")) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 830036cdd..65c41c23f 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -56,7 +56,7 @@ class MegasharesCom(SimpleHoster): for _i in xrange(5): random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) - verifyinput = self.decrypt_captcha("http://d01.megashares.com/index.php", + verifyinput = self.captcha.decrypt_image("http://d01.megashares.com/index.php", get={'secgfx': "gfx", 'random_num': random_num}) self.log_info(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) @@ -70,10 +70,10 @@ class MegasharesCom(SimpleHoster): 'rsrnd[]' : str(int(time.time() * 1000))}) if 'Thank you for reactivating your passport.' in res: - self.correct_captcha() + self.captcha.correct() self.retry() else: - self.invalid_captcha() + self.captcha.invalid() else: self.fail(_("Failed to reactivate passport")) diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index f88b5e2c7..f54fbf71e 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -43,18 +43,18 @@ class NarodRu(SimpleHoster): post_data = {'action': "sendcapcha"} captcha_url, post_data['key'] = m.groups() - post_data['rep'] = self.decrypt_captcha(captcha_url) + post_data['rep'] = self.captcha.decrypt_image(captcha_url) self.html = self.load(pyfile.url, post=post_data) m = re.search(self.LINK_FREE_PATTERN, self.html) if m: self.link = urlparse.urljoin("http://narod.ru", m.group(1)) - self.correct_captcha() + self.captcha.correct() break elif u'Ошиблись?' in self.html: - self.invalid_captcha() + self.captcha.invalid() else: self.error(_("Download link")) diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index aabd8c774..f5624439f 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -87,15 +87,15 @@ class OboomCom(Hoster): if result[0] == 200: self.download_token = result[1] self.download_auth = result[2] - self.correct_captcha() + self.captcha.correct() self.wait(30) break elif result[0] == 400: if result[1] == "incorrect-captcha-sol": - self.invalid_captcha() + self.captcha.invalid() elif result[1] == "captcha-timeout": - self.invalid_captcha() + self.captcha.invalid() elif result[1] == "forbidden": self.retry(5, 15 * 60, _("Service unavailable")) @@ -107,7 +107,7 @@ class OboomCom(Hoster): self.wait() self.retry(5) else: - self.invalid_captcha() + self.captcha.invalid() self.fail(_("Received invalid captcha 5 times")) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index c87d3b83b..7b364e150 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -140,9 +140,9 @@ class RapidgatorNet(SimpleHoster): 'adcopy_response' : response}) if "The verification code is incorrect" in self.html: - self.invalid_captcha() + self.captcha.invalid() else: - self.correct_captcha() + self.captcha.correct() else: self.error(_("Download link")) diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 77e714cae..18e66033f 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -35,20 +35,20 @@ class SendspaceCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: if 'captcha_hash' in params: - self.correct_captcha() + self.captcha.correct() self.link = m.group(1) break m = re.search(self.CAPTCHA_PATTERN, self.html) if m: if 'captcha_hash' in params: - self.invalid_captcha() + self.captcha.invalid() captcha_url1 = "http://www.sendspace.com/" + m.group(1) m = re.search(self.USER_CAPTCHA_PATTERN, self.html) captcha_url2 = "http://www.sendspace.com/" + m.group(1) params = {'captcha_hash': m.group(2), 'captcha_submit': 'Verify', - 'captcha_answer': self.decrypt_captcha(captcha_url1) + " " + self.decrypt_captcha(captcha_url2)} + 'captcha_answer': self.captcha.decrypt_image(captcha_url1) + " " + self.captcha.decrypt_image(captcha_url2)} else: params = {'download': "Regular Download"} diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 7e1c7c70c..13e4f8f87 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -80,12 +80,12 @@ class ShareonlineBiz(SimpleHoster): 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) if not res == '0': - self.correct_captcha() + self.captcha.correct() return res else: - self.invalid_captcha() + self.captcha.invalid() else: - self.invalid_captcha() + self.captcha.invalid() self.fail(_("No valid captcha solution received")) @@ -111,11 +111,11 @@ class ShareonlineBiz(SimpleHoster): 'fail' : re.compile(r"Share-Online")}) if check == "cookie": - self.invalid_captcha() + self.captcha.invalid() self.retry(5, 60, _("Cookie failure")) elif check == "fail": - self.invalid_captcha() + self.captcha.invalid() self.retry(5, 5 * 60, _("Download failed")) return super(ShareonlineBiz, self).checkFile() diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 1df2d1673..f70a985df 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -81,15 +81,15 @@ class TurbobitNet(SimpleHoster): if m is None: self.error(_("captcha")) captcha_url = m.group(1) - inputs['captcha_response'] = self.decrypt_captcha(captcha_url) + inputs['captcha_response'] = self.captcha.decrypt_image(captcha_url) self.log_debug(inputs) self.html = self.load(self.url, post=inputs) if '<div class="captcha-error">Incorrect, try again!<' in self.html: - self.invalid_captcha() + self.captcha.invalid() else: - self.correct_captcha() + self.captcha.correct() break else: self.fail(_("Invalid captcha")) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 9df9c2866..27b5843d9 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -60,7 +60,7 @@ class UlozTo(SimpleHoster): #: Old version - last seen 9.12.2013 self.log_debug('Using "old" version') - captcha_value = self.decrypt_captcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) + captcha_value = self.captcha.decrypt_image("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) self.log_debug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value}) @@ -73,7 +73,7 @@ class UlozTo(SimpleHoster): self.log_debug("xapca = " + str(xapca)) data = json_loads(xapca) - captcha_value = self.decrypt_captcha(str(data['image'])) + captcha_value = self.captcha.decrypt_image(str(data['image'])) self.log_debug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value) inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) @@ -130,7 +130,7 @@ class UlozTo(SimpleHoster): }) if check == "wrong_captcha": - self.invalid_captcha() + self.captcha.invalid() self.retry(reason=_("Wrong captcha code")) elif check == "offline": diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index b881e853a..58e3b685a 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -59,7 +59,7 @@ class UloziskoSk(SimpleHoster): self.error(_("CAPTCHA_PATTERN not found")) captcha_url = urlparse.urljoin("http://www.ulozisko.sk", m.group(1)) - captcha = self.decrypt_captcha(captcha_url, cookies=True) + captcha = self.captcha.decrypt_image(captcha_url, cookies=True) self.log_debug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 5b4295cb2..96b2fb031 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -52,10 +52,10 @@ class UnibytesCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: self.link = m.group(1) - self.correct_captcha() + self.captcha.correct() break else: - self.invalid_captcha() + self.captcha.invalid() last_step = post_data['step'] action, post_data = self.parse_html_form('id="stepForm"') @@ -65,7 +65,7 @@ class UnibytesCom(SimpleHoster): self.wait(m.group(1) if m else 60, False) elif last_step in ("captcha", "last"): - post_data['captcha'] = self.decrypt_captcha(urlparse.urljoin(domain, "/captcha.jpg")) + post_data['captcha'] = self.captcha.decrypt_image(urlparse.urljoin(domain, "/captcha.jpg")) else: self.fail(_("No valid captcha code entered")) diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 54b9f229c..8a0b3a032 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -44,7 +44,7 @@ class UploadheroCom(SimpleHoster): if m is None: self.error(_("Captcha not found")) - captcha = self.decrypt_captcha(urlparse.urljoin("http://uploadhero.co", m.group(1))) + captcha = self.captcha.decrypt_image(urlparse.urljoin("http://uploadhero.co", m.group(1))) self.html = self.load(pyfile.url, get={'code': captcha}) -- cgit v1.2.3