From 25d5726d4953b93a2e286fd6af8d4ead20670ba6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 1 Oct 2015 04:55:17 +0200 Subject: A lot of plugin code cosmetics --- module/plugins/hoster/RapidgatorNet.py | 36 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'module/plugins/hoster/RapidgatorNet.py') diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 3f2003034..711f33e87 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -86,7 +86,7 @@ class RapidgatorNet(SimpleHoster): else: self.account.relogin() - self.retry(delay=60) + self.retry(wait=60) def handle_premium(self, pyfile): @@ -122,29 +122,25 @@ class RapidgatorNet(SimpleHoster): url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) - for _i in xrange(5): - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - self.link = m.group(1) - break - else: - captcha = self.handle_captcha() + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is not None: + self.link = m.group(1) + else: + captcha = self.handle_captcha() - if not captcha: - self.error(_("Captcha pattern not found")) + if not captcha: + self.error(_("Captcha pattern not found")) - response, challenge = captcha.challenge() + response, challenge = captcha.challenge() - self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", - 'adcopy_challenge' : challenge, - 'adcopy_response' : response}) + self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", + 'adcopy_challenge' : challenge, + 'adcopy_response' : response}) - if "The verification code is incorrect" in self.html: - self.captcha.invalid() - else: - self.captcha.correct() - else: - self.error(_("Download link")) + if "The verification code is incorrect" in self.html: + self.retry_captcha() + else: + self.captcha.correct() def handle_captcha(self): -- cgit v1.2.3