diff options
-rw-r--r-- | module/plugins/captcha/AdYouLike.py | 4 | ||||
-rw-r--r-- | module/plugins/captcha/AdsCaptcha.py | 5 | ||||
-rw-r--r-- | module/plugins/captcha/ReCaptcha.py | 6 | ||||
-rw-r--r-- | module/plugins/captcha/SolveMedia.py | 5 | ||||
-rw-r--r-- | module/plugins/internal/Captcha.py | 26 | ||||
-rw-r--r-- | module/plugins/internal/Hoster.py | 4 |
6 files changed, 23 insertions, 27 deletions
diff --git a/module/plugins/captcha/AdYouLike.py b/module/plugins/captcha/AdYouLike.py index c21a3d4fa..c2e5a461d 100644 --- a/module/plugins/captcha/AdYouLike.py +++ b/module/plugins/captcha/AdYouLike.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import CaptchaService class AdYouLike(CaptchaService): __name__ = "AdYouLike" __type__ = "captcha" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __description__ = """AdYouLike captcha service plugin""" @@ -87,6 +87,4 @@ class AdYouLike(CaptchaService): '_ayl_token_challenge': challenge['token'], '_ayl_response' : response} - self.log_debug("Result: %s" % response) - return result diff --git a/module/plugins/captcha/AdsCaptcha.py b/module/plugins/captcha/AdsCaptcha.py index 234d2a0cf..eb547de8b 100644 --- a/module/plugins/captcha/AdsCaptcha.py +++ b/module/plugins/captcha/AdsCaptcha.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import CaptchaService class AdsCaptcha(CaptchaService): __name__ = "AdsCaptcha" __type__ = "captcha" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __description__ = """AdsCaptcha captcha service plugin""" @@ -58,7 +58,4 @@ class AdsCaptcha(CaptchaService): get={'cid': challenge, 'dummy': random.random()}, cookies=True, input_type="jpg") - - self.log_debug("Result: %s" % result) - return result diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py index b30f110d4..535525761 100644 --- a/module/plugins/captcha/ReCaptcha.py +++ b/module/plugins/captcha/ReCaptcha.py @@ -12,7 +12,7 @@ from module.plugins.internal.CaptchaService import CaptchaService class ReCaptcha(CaptchaService): __name__ = "ReCaptcha" __type__ = "captcha" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __description__ = """ReCaptcha captcha service plugin""" @@ -85,8 +85,6 @@ class ReCaptcha(CaptchaService): cookies=True, input_type="jpg") - self.log_debug("Result: %s" % result) - return result, challenge @@ -175,7 +173,7 @@ class ReCaptcha(CaptchaService): timeout=30) response = base64.b64encode('{"response":"%s"}' % captcha_response) - self.log_debug("Result: %s" % response) + self.log_debug("Result: `%s`" % response) timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading timeToSolveMore = timeToSolve + int(float("0." + str(random.randint(1, 99999999))) * 500) diff --git a/module/plugins/captcha/SolveMedia.py b/module/plugins/captcha/SolveMedia.py index f5fb28fa0..06a2300cb 100644 --- a/module/plugins/captcha/SolveMedia.py +++ b/module/plugins/captcha/SolveMedia.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import CaptchaService class SolveMedia(CaptchaService): __name__ = "SolveMedia" __type__ = "captcha" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __description__ = """SolveMedia captcha service plugin""" @@ -99,7 +99,4 @@ class SolveMedia(CaptchaService): get={'c': challenge}, cookies=True, input_type="gif") - - self.log_debug("Result: %s" % result) - return result diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index fe0830693..763783f82 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -12,7 +12,7 @@ from module.plugins.internal.misc import encode class Captcha(Plugin): __name__ = "Captcha" __type__ = "captcha" - __version__ = "0.48" + __version__ = "0.49" __status__ = "stable" __description__ = """Base anti-captcha plugin""" @@ -63,7 +63,7 @@ class Captcha(Plugin): :return: result of decrypting """ - result = "" + result = None time_ref = ("%.2f" % time.time())[-6:].replace(".", "") with open(os.path.join("tmp", "captcha_image_%s_%s.%s" % (self.pyfile.plugin.__name__, time_ref, input_type)), "wb") as img_f: @@ -77,6 +77,9 @@ class Captcha(Plugin): result = self.recognize(img_f.name) if not result: + if ocr: + self.log_warning(_("No OCR result")) + captchaManager = self.pyload.captchaManager try: @@ -92,19 +95,20 @@ class Captcha(Plugin): finally: captchaManager.removeTask(self.task) + result = self.task.result + if self.task.error: - self.fail(self.task.error) + self.pyfile.plugin.retry_captcha(msg=self.task.error) - elif not self.task.result: - self.pyfile.plugin.retry_captcha(msg=_("No captcha result obtained in appropriate time")) + if self.task.result: + self.log_info(_("Captcha result: `%s`") % result) - result = self.task.result + else: + self.pyfile.plugin.retry_captcha(msg=_("No captcha result obtained in appropriate timing")) if not self.pyload.debug: self.remove(img_f.name, trash=False) - # self.log_info(_("Captcha result: ") + result) #@TODO: Remove from here? - return result @@ -112,13 +116,15 @@ class Captcha(Plugin): if not self.task: return - self.log_warning(_("Invalid captcha")) + self.log_warning(_("Invalid captcha"), self.task.result) self.task.invalid() + self.task = None def correct(self): if not self.task: return - self.log_info(_("Correct captcha")) + self.log_info(_("Correct captcha"), self.task.result) self.task.correct() + self.task = None diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index 4f5bf6156..a87066502 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -34,7 +34,7 @@ if not hasattr(__builtin__.property, "setter"): class Hoster(Base): __name__ = "Hoster" __type__ = "hoster" - __version__ = "0.48" + __version__ = "0.49" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -239,7 +239,6 @@ class Hoster(Base): self.pyfile.name = dl_basename - self.captcha.correct() self.check_duplicates() self.pyfile.setStatus("downloading") @@ -285,6 +284,7 @@ class Hoster(Base): finally: self.pyfile.size = self.req.size + self.captcha.correct() if self.req.code in (404, 410): bad_file = fsjoin(dl_dirname, newname) |