(self)
| 268 | self.links = links |
| 269 | |
| 270 | def check_errors(self): |
| 271 | self.log_info(_("Checking for link errors...")) |
| 272 | |
| 273 | if not self.data: |
| 274 | self.log_warning(_("No data to check")) |
| 275 | return |
| 276 | |
| 277 | if search_pattern(self.IP_BLOCKED_PATTERN, self.data): |
| 278 | self.fail(_("Connection from your current IP address is not allowed")) |
| 279 | |
| 280 | elif not self.premium: |
| 281 | if search_pattern(self.PREMIUM_ONLY_PATTERN, self.data): |
| 282 | self.fail(_("Link can be decrypted by premium users only")) |
| 283 | |
| 284 | elif search_pattern(self.SIZE_LIMIT_PATTERN, self.data): |
| 285 | self.fail(_("Link list too large for free decrypt")) |
| 286 | |
| 287 | if self.ERROR_PATTERN: |
| 288 | m = search_pattern(self.ERROR_PATTERN, self.data) |
| 289 | if m is not None: |
| 290 | try: |
| 291 | errmsg = m.group(1) |
| 292 | |
| 293 | except (AttributeError, IndexError): |
| 294 | errmsg = m.group(0) |
| 295 | |
| 296 | finally: |
| 297 | errmsg = re.sub(r'<.*?>', " ", errmsg.strip()) |
| 298 | |
| 299 | self.info['error'] = errmsg |
| 300 | self.log_warning(errmsg) |
| 301 | |
| 302 | if search_pattern(self.TEMP_OFFLINE_PATTERN, errmsg): |
| 303 | self.temp_offline() |
| 304 | |
| 305 | elif search_pattern(self.OFFLINE_PATTERN, errmsg): |
| 306 | self.offline() |
| 307 | |
| 308 | elif re.search(r'limit|wait|slot', errmsg, re.I): |
| 309 | wait_time = parse_time(errmsg) |
| 310 | self.wait(wait_time, reconnect=wait_time > self.config.get('max_wait', 10) * 60) |
| 311 | self.restart(_("Download limit exceeded")) |
| 312 | |
| 313 | elif re.search(r'country|ip|region|nation', errmsg, re.I): |
| 314 | self.fail(_("Connection from your current IP address is not allowed")) |
| 315 | |
| 316 | elif re.search(r'captcha|code', errmsg, re.I): |
| 317 | self.retry_captcha() |
| 318 | |
| 319 | elif re.search(r'countdown|expired', errmsg, re.I): |
| 320 | self.retry(10, 60, _("Link expired")) |
| 321 | |
| 322 | elif re.search(r'503|maint(e|ai)nance|temp|mirror', errmsg, re.I): |
| 323 | self.temp_offline() |
| 324 | |
| 325 | elif re.search(r'up to|size', errmsg, re.I): |
| 326 | self.fail(_("Link list too large for free decrypt")) |
| 327 |
no test coverage detected