def check_errors(self): self.log_info(self._("Checking for link errors...")) if not self.data: self.log_warning(self._("No data to check")) return m = re.search(self.LOGIN_BAN_PATTERN, self.data) if m is not None: try: errmsg = m.group(1) except (AttributeError, IndexError): errmsg = m.group(0) finally: errmsg = re.sub(r"<.*?>", " ", errmsg.strip()) new_timeout = parse_time(errmsg) if new_timeout > self.timeout: self.timeout = new_timeout self.fail_login(errmsg) m = re.search(self.LOGIN_FAIL_PATTERN, self.data) if m is not None: try: errmsg = m.group(1) except (AttributeError, IndexError): errmsg = m.group(0) finally: errmsg = re.sub(r"<.*?>", " ", errmsg.strip()) self.timeout = self.LOGIN_TIMEOUT self.fail_login(errmsg) self.log_info(self._("No errors found"))
def _post_parameters(self): if self.FORM_PATTERN or self.FORM_INPUTS_MAP: action, inputs = self.parse_html_form( self.FORM_PATTERN or "", self.FORM_INPUTS_MAP or {} ) else: action, inputs = self.parse_html_form( input_names={"op": re.compile(r"^download")} ) if not inputs: action, inputs = self.parse_html_form("F1") if not inputs: self.retry( msg=self.info.get("error") or self._("TEXTAREA F1 not found") ) self.log_debug(inputs) if "op" in inputs: if "password" in inputs: password = self.get_password() if password: inputs["password"] = password else: self.fail(self._("Missing password")) if not self.premium: m = re.search(self.WAIT_PATTERN, self.data) if m is not None: try: waitmsg = m.group(1).strip() except (AttributeError, IndexError): waitmsg = m.group(0).strip() wait_time = parse_time(waitmsg) self.set_wait(wait_time) if ( wait_time < timedelta(minutes=self.config.get("max_wait", 10)).seconds or not self.pyload.config.get("reconnect", "enabled") or not self.pyload.api.is_time_reconnect() ): self.handle_captcha(inputs) self.wait() else: self.handle_captcha(inputs) if "referer" in inputs and len(inputs["referer"]) == 0: inputs["referer"] = self.pyfile.url else: inputs["referer"] = self.pyfile.url if self.premium: inputs["method_premium"] = "Premium Download" inputs.pop("method_free", None) else: inputs["method_free"] = "Free Download" inputs.pop("method_premium", None) return inputs
def check_errors(self): self.log_info(self._("Checking for link errors...")) if not self.data: self.log_warning(self._("No data to check")) return if self.IP_BLOCKED_PATTERN and re.search(self.IP_BLOCKED_PATTERN, self.data): self.fail(self._("Connection from your current IP address is not allowed")) elif not self.premium: if self.PREMIUM_ONLY_PATTERN and re.search( self.PREMIUM_ONLY_PATTERN, self.data ): self.fail(self._("Link can be decrypted by premium users only")) elif self.SIZE_LIMIT_PATTERN and re.search( self.SIZE_LIMIT_PATTERN, self.data ): self.fail(self._("Link list too large for free decrypt")) if self.ERROR_PATTERN: m = re.search(self.ERROR_PATTERN, self.data) if m is not None: try: errmsg = m.group(1) except (AttributeError, IndexError): errmsg = m.group(0) finally: errmsg = re.sub(r"<.*?>", " ", errmsg.strip()) self.info["error"] = errmsg self.log_warning(errmsg) if re.search(self.TEMP_OFFLINE_PATTERN, errmsg): self.temp_offline() elif re.search(self.OFFLINE_PATTERN, errmsg): self.offline() elif re.search(r"limit|wait|slot", errmsg, re.I): wait_time = parse_time(errmsg) self.wait( wait_time, reconnect=wait_time > self.config.get("max_wait", 10) * 60, ) self.restart(self._("Download limit exceeded")) elif re.search(r"country|ip|region|nation", errmsg, re.I): self.fail( self._("Connection from your current IP address is not allowed") ) elif re.search(r"captcha|code", errmsg, re.I): self.retry_captcha() elif re.search(r"countdown|expired", errmsg, re.I): self.retry(10, 60, self._("Link expired")) elif re.search(r"503|maint(e|ai)nance|temp|mirror", errmsg, re.I): self.temp_offline() elif re.search(r"up to|size", errmsg, re.I): self.fail(self._("Link list too large for free decrypt")) elif re.search( r"404|sorry|offline|delet|remov|(no(t|thing)?|sn\'t) (found|(longer )?(available|exist))", errmsg, re.I, ): self.offline() elif re.search(r"filename", errmsg, re.I): self.fail(self._("Invalid url")) elif re.search(r"premium", errmsg, re.I): self.fail(self._("Link can be decrypted by premium users only")) else: self.wait(60, reconnect=True) self.restart(errmsg) elif self.WAIT_PATTERN: m = re.search(self.WAIT_PATTERN, self.data) if m is not None: try: waitmsg = m.group(1).strip() except (AttributeError, IndexError): waitmsg = m.group(0).strip() wait_time = parse_time(waitmsg) self.wait( wait_time, reconnect=wait_time > self.config.get("max_wait", 10) * 60, ) self.log_info(self._("No errors found")) self.info.pop("error", None)
def check_errors(self): m = re.search(r">Please wait (.+?) till next download<", self.data) if m is not None: self.retry(wait=parse_time(m.group(1))) SimpleDownloader.check_errors(self)