@Override
 public boolean isProxyBannedByUrlOrPlugin(
     final HTTPProxy proxy,
     final URL url,
     final Plugin pluginFromThread,
     boolean ignoreConnectBans) {
   if (!ignoreConnectBans && proxyEquals(getProxy(), proxy)) {
     final boolean ret =
         getPort() == getPort(url)
             && StringUtils.containsIgnoreCase(getHost(), Browser.getHost(url))
             && StringUtils.equals(getProtocol(), url.getProtocol());
     return ret;
   }
   return false;
 }
 @Override
 public boolean isSelectorBannedByPlugin(final Plugin plugin, final boolean ignoreConnectBans) {
   final String host = plugin.getHost();
   return !ignoreConnectBans && StringUtils.containsIgnoreCase(getHost(), host);
 }
Exemplo n.º 3
0
 private void handleErrorsAPI() throws PluginException {
   final int code = getAPIStatuscode(this.br);
   String msg = PluginJSonUtils.getJsonValue(this.br, "msg");
   if (msg == null) {
     msg = "Unknown API error";
   }
   switch (code) {
     case api_status_all_ok:
       /* Everything ok */
       break;
     case 0:
       /* Fatal API error - this should never happen! */
       throw new PluginException(LinkStatus.ERROR_FATAL, msg);
     case 1:
       if ("de".equalsIgnoreCase(System.getProperty("user.language"))) {
         throw new PluginException(
             LinkStatus.ERROR_PREMIUM,
             "\r\nUngültiger Benutzername/Passwort!\r\nDu bist dir sicher, dass dein eingegebener Benutzername und Passwort stimmen? Versuche folgendes:\r\n1. Falls dein Passwort Sonderzeichen enthält, ändere es (entferne diese) und versuche es erneut!\r\n2. Gib deine Zugangsdaten per Hand (ohne kopieren/einfügen) ein.",
             PluginException.VALUE_ID_PREMIUM_DISABLE);
       } else {
         throw new PluginException(
             LinkStatus.ERROR_PREMIUM,
             "\r\nInvalid username/password!\r\nYou're sure that the username and password you entered are correct? Some hints:\r\n1. If your password contains special characters, change it (remove them) and try again!\r\n2. Type in your username/password by hand without copy & paste.",
             PluginException.VALUE_ID_PREMIUM_DISABLE);
       }
     case 2:
       /* Folderlink does not exist --> This errorcode should only happen inside jd.plugins.decrypter.CatShareNetFolder !! */
       if (StringUtils.containsIgnoreCase(br.getURL(), "/login/")) {
         throw new PluginException(
             LinkStatus.ERROR_PREMIUM,
             "\r\nInvalid username/password!\r\nYou're sure that the username and password you entered are correct? Some hints:\r\n1. If your password contains special characters, change it (remove them) and try again!\r\n2. Type in your username/password by hand without copy & paste.",
             PluginException.VALUE_ID_PREMIUM_DISABLE);
       }
       throw new PluginException(LinkStatus.ERROR_FATAL, msg);
     case 8:
       /* Daily downloadlimit reached (usually happens for premium accounts) */
       throw new PluginException(
           LinkStatus.ERROR_PREMIUM, msg, PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE);
     case 9:
       /* Not enough traffic available */
       throw new PluginException(
           LinkStatus.ERROR_PREMIUM, msg, PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE);
     case 10:
       /* WTF - "U didnt follow the rules!" */
       throw new PluginException(LinkStatus.ERROR_FATAL, "FATAL API error: " + msg);
     case 11:
       /* Wrong captcha input */
       throw new PluginException(LinkStatus.ERROR_CAPTCHA, msg);
     case 12:
       /* "You have to wait" --> (Free) limit reached */
       long wait = 3 * 60 * 60 * 1001l;
       final String wait_str = PluginJSonUtils.getJsonValue(this.br, "wait_time");
       /* wait_time can also be of type Boolean! */
       if (wait_str != null && wait_str.matches("\\d+")) {
         wait = 1001 * Long.parseLong(wait_str);
       }
       throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, msg, wait);
     case 13:
       /* File offline */
       throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, msg);
     case 14:
       /*
        * Too many links (if someone tried to check more than X(see CheckLinks mass-linkchecker-function) links per request - this
        * should NEVER happen!
        */
       throw new PluginException(LinkStatus.ERROR_FATAL, msg);
     default:
       throw new PluginException(LinkStatus.ERROR_FATAL, msg);
   }
 }