diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-01 04:55:17 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-01 04:55:17 +0200 |
commit | 25d5726d4953b93a2e286fd6af8d4ead20670ba6 (patch) | |
tree | 9d38f6942af2fadc094a75dd43699051f356b4d7 /module/plugins/hoster/OboomCom.py | |
parent | [AntiVirus] Folder support (diff) | |
download | pyload-25d5726d4953b93a2e286fd6af8d4ead20670ba6.tar.xz |
A lot of plugin code cosmetics
Diffstat (limited to 'module/plugins/hoster/OboomCom.py')
-rw-r--r-- | module/plugins/hoster/OboomCom.py | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index d294ae3c6..77cf6b68f 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -74,41 +74,36 @@ class OboomCom(Hoster): def solve_captcha(self): recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - for _i in xrange(5): - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - apiUrl = "http://www.oboom.com/1.0/download/ticket" - params = {'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response, - 'download_id': self.file_id, - 'token': self.session_token} - result = self.load_url(apiUrl, params) + apiUrl = "http://www.oboom.com/1.0/download/ticket" + params = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response, + 'download_id': self.file_id, + 'token': self.session_token} - if result[0] == 200: - self.download_token = result[1] - self.download_auth = result[2] - self.captcha.correct() - self.wait(30) - break - - elif result[0] == 400: - if result[1] == "incorrect-captcha-sol": - self.captcha.invalid() - elif result[1] == "captcha-timeout": - self.captcha.invalid() - elif result[1] == "forbidden": - self.retry(5, 15 * 60, _("Service unavailable")) - - elif result[0] == 403: + result = self.load_url(apiUrl, params) + + if result[0] == 200: + self.download_token = result[1] + self.download_auth = result[2] + self.captcha.correct() + self.wait(30) + + else: + if result[0] == 403: if result[1] == -1: #: Another download is running self.set_wait(15 * 60) else: self.set_wait(result[1], True) + self.wait() self.retry(5) - else: - self.captcha.invalid() - self.fail(_("Received invalid captcha 5 times")) + + elif result[0] == 400 and result[1] == "forbidden": + self.retry(5, 15 * 60, _("Service unavailable")) + + self.retry_captcha() def get_fileInfo(self, token, fileId): @@ -141,6 +136,6 @@ class OboomCom(Hoster): self.download_domain = result[1] self.download_ticket = result[2] elif result[0] == 421: - self.retry(delay=result[2] + 60, msg=_("Connection limit exceeded")) + self.retry(wait=result[2] + 60, msg=_("Connection limit exceeded")) else: self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) |