Exemple #1
0
 private void updateAccountInfo(final Account account, final Browser br) {
   if (account == null || br == null) {
     return;
   }
   AccountInfo ai = account.getAccountInfo();
   if (ai == null) {
     ai = new AccountInfo();
     account.setAccountInfo(ai);
   }
   /* let hoster report traffic limit reached! */
   // ai.setSpecialTraffic(true);
   /* reset expired flag */
   ai.setExpired(false);
   ai.setValidUntil(-1);
   account.setValid(true);
   ai.setUnlimitedTraffic();
   try {
     final String[][] matches = br.getRegex("(\\w+)=([^\r^\n]+)").getMatches();
     final HashMap<String, String> data = this.getMap(matches);
     final long rapids = Long.parseLong(data.get("rapids"));
     /* account infos */
     ai.setFilesNum(Long.parseLong(data.get("curfiles")));
     ai.setPremiumPoints(Long.parseLong(data.get("rapids")));
     ai.setUsedSpace(Long.parseLong(data.get("curspace")));
     boolean autoextend = "1".equals(data.get("autoextend"));
     final String billedUntilTime = data.get("billeduntil");
     final String serverTimeString = data.get("servertime");
     long nextBill = 0;
     if (billedUntilTime != null && serverTimeString != null) {
       /* next billing in */
       nextBill = Long.parseLong(billedUntilTime) - Long.parseLong(serverTimeString);
       if (nextBill <= 0) {
         String possible = "";
         if (autoextend) {
           long days = (rapids / 495) * 30;
           if (days > 0) {
             possible = "(enough rapids for " + days + " days RapidPro left)";
           }
         }
         ai.setStatus("No RapidPro" + possible);
         ai.setExpired(true);
         account.setValid(false);
       } else {
         if (autoextend) {
           long days = (rapids / 495) * 30;
           if (days > 0) {
             nextBill = nextBill + (days * 24 * 60);
           }
         }
         final String left = Formatter.formatSeconds(nextBill, false);
         ai.setValidUntil((Long.parseLong(serverTimeString) + nextBill) * 1000l);
         ai.setStatus("Valid for " + left);
       }
     }
   } catch (final Throwable e) {
     logger.severe("RS-API change detected, please inform support!");
   }
 }
Exemple #2
0
 @Override
 public AccountInfo fetchAccountInfo(final Account account) throws Exception {
   AccountInfo ai = new AccountInfo();
   try {
     login(account);
   } catch (final PluginException e) {
     account.setValid(false);
     throw e;
   }
   account.setValid(true);
   ai.setUnlimitedTraffic();
   if (!nopremium) {
     String expire = br.getRegex("You have <b>premium</b> account till(.*?)</p>").getMatch(0);
     if (expire == null) {
       ai.setExpired(true);
       account.setValid(false);
       return ai;
     } else {
       ai.setValidUntil(TimeFormatter.getMilliSeconds(expire.trim(), "dd.MM.yyyy HH:mm", null));
     }
     ai.setStatus("Premium Account");
   } else {
     ai.setStatus("Registered (free) User");
   }
   return ai;
 }
Exemple #3
0
 @Override
 public AccountInfo fetchAccountInfo(Account account) throws Exception {
   AccountInfo ai = new AccountInfo();
   try {
     login(account, true);
   } catch (PluginException e) {
     account.setValid(false);
     return ai;
   }
   String space =
       br.getRegex(
               Pattern.compile(
                   "<td>Used space:</td>.*?<td.*?b>([0-9\\.]+) of [0-9\\.]+ (Mb|GB)</b>",
                   Pattern.DOTALL | Pattern.CASE_INSENSITIVE))
           .getMatch(0);
   if (space != null) {
     ai.setUsedSpace(space.trim() + " Mb");
   }
   account.setValid(true);
   String availabletraffic =
       new Regex(correctedBR, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
   if (availabletraffic != null
       && !availabletraffic.contains("nlimited")
       && !availabletraffic.equalsIgnoreCase(" Mb")) {
     availabletraffic.trim();
     // need to set 0 traffic left, as getSize returns positive result, even when negative value
     // supplied.
     if (!availabletraffic.startsWith("-")) {
       ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
     } else {
       ai.setTrafficLeft(0);
     }
   } else {
     ai.setUnlimitedTraffic();
   }
   if (account.getBooleanProperty("nopremium")) {
     ai.setStatus("Registered (free) User");
   } else {
     String expire =
         new Regex(
                 correctedBR,
                 Pattern.compile(
                     "<td>Premium(\\-| )Account expires?:</td>.*?<td>(<b>)?(\\d{1,2} [A-Za-z]+ \\d{4})(</b>)?</td>",
                     Pattern.CASE_INSENSITIVE))
             .getMatch(2);
     if (expire == null) {
       ai.setExpired(true);
       account.setValid(false);
       return ai;
     } else {
       expire = expire.replaceAll("(<b>|</b>)", "");
       ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", null));
     }
     ai.setStatus("Premium User");
   }
   return ai;
 }
Exemple #4
0
  @Override
  public AccountInfo fetchAccountInfo(Account account) throws Exception {
    AccountInfo ac = new AccountInfo();
    br.setConnectTimeout(60 * 1000);
    br.setReadTimeout(60 * 1000);
    String hosts;
    login(account);

    ac.setTrafficLeft(GetTrasferLeft(Info));

    ArrayList<String> supportedHosts = new ArrayList<String>();
    hosts = br.getPage("https://www.twojlimit.pl/clipboard.php");
    if (hosts != null) {
      String hoster[] = new Regex(hosts, "(.*?)(<br />|$)").getColumn(0);
      if (hosts != null) {
        for (String host : hoster) {
          if (hosts == null || host.length() == 0) {
            continue;
          }
          supportedHosts.add(host.trim());
        }
      }
    }
    if (expired) {
      ac.setExpired(true);
      ac.setStatus("Account expired");
      ac.setValidUntil(0);
      return ac;
    } else {
      ac.setExpired(false);
      if (validUntil != null) {
        if (validUntil.trim().equals("expire=00")) {
          ac.setValidUntil(-1);
        } else {
          ac.setValidUntil(TimeFormatter.getMilliSeconds(validUntil));
        }
      }
    }
    ac.setMultiHostSupport(this, supportedHosts);
    ac.setStatus("Account valid");
    return ac;
  }
  @Override
  public AccountInfo fetchAccountInfo(Account account) throws Exception {
    AccountInfo ai = new AccountInfo();
    try {
      login(account, true);
    } catch (PluginException e) {
      account.setValid(false);
      return ai;
    }
    if (!br.getURL().endsWith("/members.php")) br.getPage(COOKIE_HOST + "/members.php");
    String expired = getData("Expired\\?");
    if (expired != null) {
      expired = expired.trim();
      if (expired.equalsIgnoreCase("No")) ai.setExpired(false);
      else if (expired.equalsIgnoreCase("Yes")) ai.setExpired(true);
    }
    String expires = getData("Package Expire Date");
    if (expires != null) {
      String[] e = expires.split("/");
      Calendar cal =
          new GregorianCalendar(
              Integer.parseInt("20" + e[2]), Integer.parseInt(e[0]) - 1, Integer.parseInt(e[1]));
      ai.setValidUntil(cal.getTimeInMillis());
    }
    String create = getData("Register Date");
    if (create != null) {
      String[] c = create.split("/");
      Calendar cal =
          new GregorianCalendar(
              Integer.parseInt("20" + c[2]), Integer.parseInt(c[0]) - 1, Integer.parseInt(c[1]));
      ai.setCreateTime(cal.getTimeInMillis());
    }
    String files = getData("Hosted Files");
    if (files != null) {
      ai.setFilesNum(Integer.parseInt(files.trim()));
    }
    ai.setStatus("Premium User");
    account.setValid(true);

    return ai;
  }
Exemple #6
0
 @Override
 public AccountInfo fetchAccountInfo(Account account) throws Exception {
   AccountInfo ai = new AccountInfo();
   /* reset maxPrem workaround on every fetchaccount info */
   maxPrem.set(1);
   try {
     login(account, true);
   } catch (PluginException e) {
     account.setValid(false);
     return ai;
   }
   String space[][] =
       new Regex(
               correctedBR,
               "<td>Used space:</td>.*?<td.*?b>([0-9\\.]+) of [0-9\\.]+ (KB|MB|GB|TB)</b>")
           .getMatches();
   if ((space != null && space.length != 0) && (space[0][0] != null && space[0][1] != null))
     ai.setUsedSpace(space[0][0] + " " + space[0][1]);
   account.setValid(true);
   String availabletraffic =
       new Regex(correctedBR, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
   if (availabletraffic != null
       && !availabletraffic.contains("nlimited")
       && !availabletraffic.equalsIgnoreCase(" Mb")) {
     ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
   } else {
     ai.setUnlimitedTraffic();
   }
   if (account.getBooleanProperty("nopremium")) {
     ai.setStatus("Registered (free) User");
     try {
       maxPrem.set(4);
       // free accounts can still have captcha.
       totalMaxSimultanFreeDownload.set(maxPrem.get());
       account.setMaxSimultanDownloads(4);
       account.setConcurrentUsePossible(false);
     } catch (final Throwable e) {
     }
   } else {
     String expire =
         new Regex(
                 correctedBR,
                 "<td>Premium(\\-| )Account expires?:</td>.*?<td>(<b>)?(\\d{1,2} [A-Za-z]+ \\d{4})(</b>)?</td>")
             .getMatch(2);
     if (expire == null)
       expire = new Regex(correctedBR, "(\\d{1,2} [A-Za-z]+ \\d{4})").getMatch(0);
     if (expire == null) {
       ai.setExpired(true);
       account.setValid(false);
       return ai;
     } else {
       expire = expire.replaceAll("(<b>|</b>)", "");
       ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", null));
       try {
         maxPrem.set(-1);
         account.setMaxSimultanDownloads(-1);
         account.setConcurrentUsePossible(true);
       } catch (final Throwable e) {
       }
     }
     ai.setStatus("Premium User");
   }
   return ai;
 }
 @Override
 public AccountInfo fetchAccountInfo(Account account) throws Exception {
   AccountInfo ai = new AccountInfo();
   try {
     login(account, true);
   } catch (PluginException e) {
     account.setValid(false);
     return ai;
   }
   String space =
       br.getRegex(
               Pattern.compile(
                   "<td>Used space:</td>.*?<td.*?b>([0-9\\.]+) of [0-9\\.]+ (Mb|GB)</b>",
                   Pattern.DOTALL | Pattern.CASE_INSENSITIVE))
           .getMatch(0);
   if (space != null) ai.setUsedSpace(space.trim() + " Mb");
   String points =
       br.getRegex(
               Pattern.compile(
                   "<td>You have collected:</td.*?b>([^<>\"\\']+)premium points",
                   Pattern.CASE_INSENSITIVE))
           .getMatch(0);
   if (points != null) {
     /** Who needs half points ? If we have a dot in the points, just remove it */
     if (points.contains(".")) {
       String dot = new Regex(points, ".*?(\\.(\\d+))").getMatch(0);
       points = points.replace(dot, "");
     }
     ai.setPremiumPoints(Long.parseLong(points.trim()));
   }
   account.setValid(true);
   String availabletraffic =
       new Regex(correctedBR, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
   if (availabletraffic != null
       && !availabletraffic.contains("nlimited")
       && !availabletraffic.equalsIgnoreCase(" Mb")) {
     ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
   } else {
     ai.setUnlimitedTraffic();
   }
   if (account.getBooleanProperty("nopremium")) {
     ai.setStatus("Registered (free) User");
   } else {
     String expire =
         new Regex(
                 correctedBR,
                 Pattern.compile(
                     "<td>Premium(\\-| )Account expires?:</td>.*?<td>(<b>)?(\\d{1,2} [A-Za-z]+ \\d{4})(</b>)?</td>",
                     Pattern.CASE_INSENSITIVE))
             .getMatch(2);
     if (expire == null) {
       ai.setExpired(true);
       account.setValid(false);
       return ai;
     } else {
       expire = expire.replaceAll("(<b>|</b>)", "");
       ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", null));
     }
     ai.setStatus("Premium User");
   }
   return ai;
 }
Exemple #8
0
 @Override
 public AccountInfo fetchAccountInfo(final Account account) throws Exception {
   final AccountInfo ai = new AccountInfo();
   /* reset maxPrem workaround on every fetchaccount info */
   maxPrem.set(1);
   try {
     login(account, true);
   } catch (final PluginException e) {
     account.setValid(false);
     throw e;
   }
   final String space[] =
       new Regex(correctedBR, ">Used space:</td>.*?<td.*?b>([0-9\\.]+) ?(KB|MB|GB|TB)?</b>")
           .getRow(0);
   if ((space != null && space.length != 0) && (space[0] != null && space[1] != null)) {
     // free users it's provided by default
     ai.setUsedSpace(space[0] + " " + space[1]);
   } else if ((space != null && space.length != 0) && space[0] != null) {
     // premium users the Mb value isn't provided for some reason...
     ai.setUsedSpace(space[0] + "Mb");
   }
   account.setValid(true);
   final String availabletraffic =
       new Regex(correctedBR, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
   if (availabletraffic != null
       && !availabletraffic.contains("nlimited")
       && !availabletraffic.equalsIgnoreCase(" Mb")) {
     availabletraffic.trim();
     // need to set 0 traffic left, as getSize returns positive result, even when negative value
     // supplied.
     if (!availabletraffic.startsWith("-")) {
       ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
     } else {
       ai.setTrafficLeft(0);
     }
   } else {
     ai.setUnlimitedTraffic();
   }
   if (account.getBooleanProperty("nopremium")) {
     ai.setStatus("Registered (free) User");
     try {
       maxPrem.set(1);
       // free accounts can still have captcha.
       totalMaxSimultanFreeDownload.set(maxPrem.get());
       account.setMaxSimultanDownloads(maxPrem.get());
       account.setConcurrentUsePossible(false);
     } catch (final Throwable e) {
       // not available in old Stable 0.9.581
     }
   } else {
     final String expire =
         new Regex(
                 correctedBR,
                 "(\\d{1,2} (January|February|March|April|May|June|July|August|September|October|November|December) \\d{4})")
             .getMatch(0);
     if (expire == null) {
       ai.setExpired(true);
       account.setValid(false);
       return ai;
     } else {
       ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", Locale.ENGLISH));
       try {
         maxPrem.set(20);
         account.setMaxSimultanDownloads(maxPrem.get());
         account.setConcurrentUsePossible(true);
       } catch (final Throwable e) {
         // not available in old Stable 0.9.581
       }
     }
     ai.setStatus("Premium User");
   }
   return ai;
 }
Exemple #9
0
  private AccountInfo fetchAccountInfoWebsite(final Account account) {
    final AccountInfo ai = new AccountInfo();
    boolean hours = false;

    if (account.getType() == AccountType.PREMIUM) {
      final String dailyLimitLeft =
          br.getRegex("<li><a href=\"/premium\">([^<>\"\\']+)</a></li>").getMatch(0);
      if (dailyLimitLeft != null) {
        ai.setTrafficMax(SizeFormatter.getSize("20 GB"));
        ai.setTrafficLeft(SizeFormatter.getSize(dailyLimitLeft, true, true));
      } else {
        ai.setUnlimitedTraffic();
      }

      String expire =
          br.getRegex(
                  ">Konto premium ważne do : <strong>(\\d{4}\\-\\d+{2}\\-\\d{2} \\d{2}:\\d{2}:\\d{2})<")
              .getMatch(0);
      if (expire == null) {
        expire = br.getRegex("(\\d{4}\\-\\d+{2}\\-\\d{2} \\d{2}:\\d{2}:\\d{2})").getMatch(0);
        if (expire == null) {
          // for the last day of the premium period
          if (br.containsHTML("Konto premium ważne do : <strong>-</strong></span>")) {
            // 0 days left
            expire =
                br.getRegex(
                        "<a href=\"/premium\">(Konto:[\t\n\r ]+)*Premium \\(<b>(\\d) dni</b>\\)+[ \t\n\r]+</a>")
                    .getMatch(1);
            if (expire == null) {
              expire =
                  br.getRegex(
                          "(Konto:[\r\t\n ]+)+Premium \\(<b><span style=\"color: red\">(\\d+) godzin</span></b>\\)")
                      .getMatch(1);
              hours = true;
            }
          }
          if (expire == null) {
            ai.setExpired(true);
            return ai;
          }
        }
      }
      if (expire.equals("0") && (dailyLimitLeft != null)) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        String dateNow = formatter.format(Calendar.getInstance().getTime());
        dateNow = dateNow + " 23:59:59";
        ai.setValidUntil(
            TimeFormatter.getMilliSeconds(dateNow, "yyyy-MM-dd HH:mm:ss", Locale.ENGLISH));
      } else {
        if (hours) {
          SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
          Calendar cal = Calendar.getInstance();
          cal.setTime(new Date());
          cal.add(Calendar.HOUR_OF_DAY, Integer.parseInt(expire));
          String dateExpire = formatter.format(cal.getTime());

          ai.setValidUntil(
              TimeFormatter.getMilliSeconds(dateExpire, "yyyy-MM-dd HH:mm:ss", Locale.ENGLISH));

        } else {
          ai.setValidUntil(
              TimeFormatter.getMilliSeconds(expire, "yyyy-MM-dd HH:mm:ss", Locale.ENGLISH));
        }
      }
      account.setMaxSimultanDownloads(-1);
      account.setConcurrentUsePossible(true);

      ai.setStatus(getPhrase("PREMIUM"));
    } else {
      account.setMaxSimultanDownloads(1);
      ai.setStatus(getPhrase("FREE"));
    }

    return ai;
  }
Exemple #10
0
  @SuppressWarnings("deprecation")
  @Override
  public AccountInfo fetchAccountInfo(final Account account) throws Exception {
    final AccountInfo ai = new AccountInfo();

    try {
      login(account, true);
    } catch (final PluginException e) {
      ai.setStatus("Login failed");
      account.setValid(false);
      throw e;
    }
    final String trafficleft =
        br.getRegex("id=\"info_credit\" class=\"va-middle\">[\n\t\r ]+<strong>(.*?)</strong>")
            .getMatch(0);
    String premiumActive =
        br.getRegex(
                "<div class=\"icon-timecredit icon\">[\n\t\r]+<h4>Premium account</h4>[\n\t\r]+(.*)[\n\t\r]+<br />[\n\t\r]+<a href=\"/credit/time\">Buy</a>")
            .getMatch(0);

    if (premiumActive == null) {
      // Premium User
      premiumActive =
          br.getRegex(
                  "<div class=\"icon-timecredit icon\">[\n\t\r]+<h4>Premium account</h4>[\n\t\r]+(.*)<br />[\n\t\r]+<a href=\"/credit/time\">Buy</a>")
              .getMatch(0);
    }

    if (premiumActive == null) {
      // User with Credits
      premiumActive =
          br.getRegex(
                  "<div class=\"icon-credit icon\">[\n\t\r]+<h4>(.*)</h4>[\n\t\r]+<table>+[\n\t\r]+<tr>[\n\t\r]+<th>Current:</th>[\n\t\r]+<td>(.*?)</td>[\n\t\r]+</tr>")
              .getMatch(0);
    }

    if (trafficleft != null) {
      ai.setTrafficLeft(SizeFormatter.getSize(trafficleft));
      ai.setValidUntil(-1);
      ai.setStatus("Account with credits");
      account.setValid(true);
      account.setProperty("free", false);
    } else if (premiumActive == null) {
      ai.setStatus("Invalid/Unknown");
      account.setValid(false);
    } else if (premiumActive.contains("Inactive")) {
      ai.setStatus("Free User");
      // for inactive - set traffic left to 0
      ai.setTrafficLeft(0l);
      account.setValid(true);
      account.setProperty("free", true);
    } else if (premiumActive.contains("Active")) {
      String validUntil = premiumActive.substring(premiumActive.indexOf(":") + 1);
      // page only displays full day, so JD fails in the last day of Premium
      // added time as if the account is Premium until the midnight
      validUntil += " 23:59:59";
      ai.setValidUntil(TimeFormatter.getMilliSeconds(validUntil, "dd.MM.yyyy HH:mm:ss", null));
      ai.setStatus("Premium accoount");
      ai.setExpired(false);
      account.setValid(true);
      account.setProperty("free", false);
    }
    return ai;
  }
 @Override
 public AccountInfo fetchAccountInfo(Account account) throws Exception {
   AccountInfo ai = new AccountInfo();
   synchronized (LOCK) {
     try {
       login(account, true, true);
     } catch (PluginException e) {
       if (br.containsHTML("Your IP is temporarily blocked due to 3 incorrect login attempts")) {
         ai.setStatus("Your IP is temporarily blocked due to 3 incorrect login attempts");
       }
       account.setValid(false);
       return ai;
     }
     // account disabled due to breach of terms and conditions
     if (br.containsHTML(
         ">Your account was disabled due to violation of our Terms of Service\\.<")) {
       logger.warning("Hoster disabled account due to violation of hosters Terms of Service.");
       ai.setStatus("Hoster disabled account due to violation of hosters Terms of Service.");
       account.setValid(false);
       return ai;
     }
     String space =
         br.getRegex(
                 Pattern.compile(
                     "<td>Used space:</td>.*?<td.*?b>([0-9\\.]+) of [0-9\\.]+ (Mb|GB)</b>",
                     Pattern.DOTALL | Pattern.CASE_INSENSITIVE))
             .getMatch(0);
     if (space != null) ai.setUsedSpace(space.trim() + " Mb");
     String points =
         br.getRegex(
                 Pattern.compile(
                     "<td>You have collected:</td.*?b>([^<>\"\\']+)premium points",
                     Pattern.CASE_INSENSITIVE))
             .getMatch(0);
     if (points != null) {
       /** Who needs half points ? If we have a dot in the points, just remove it */
       if (points.contains(".")) {
         String dot = new Regex(points, ".*?(\\.(\\d+))").getMatch(0);
         points = points.replace(dot, "");
       }
       ai.setPremiumPoints(Long.parseLong(points.trim()));
     }
     account.setValid(true);
     String availabletraffic =
         new Regex(BRBEFORE, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
     if (availabletraffic != null
         && !availabletraffic.contains("nlimited")
         && !availabletraffic.equalsIgnoreCase(" Mb")) {
       availabletraffic.trim();
       // need to set 0 traffic left, as getSize returns positive result, even when negative value
       // supplied.
       if (!availabletraffic.startsWith("-")) {
         ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
       } else {
         ai.setTrafficLeft(0);
       }
     } else {
       ai.setUnlimitedTraffic();
     }
     if (account.getBooleanProperty("nopremium")) {
       ai.setStatus("Registered (free) User");
     } else {
       String expire =
           new Regex(
                   BRBEFORE,
                   Pattern.compile(
                       "<td>Premium(\\-| )Account expires?:</td>.*?<td>(<b>)?(\\d{1,2} [A-Za-z]+ \\d{4})(</b>)?</td>",
                       Pattern.CASE_INSENSITIVE))
               .getMatch(2);
       if (expire == null) {
         account.setProperty("cookies", null);
         ai.setExpired(true);
         account.setValid(false);
         return ai;
       } else {
         expire = expire.replaceAll("(<b>|</b>)", "");
         ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", Locale.ENGLISH));
       }
       ai.setStatus("Premium User");
     }
   }
   return ai;
 }
Exemple #12
0
 @Override
 public AccountInfo fetchAccountInfo(Account account) throws Exception {
   AccountInfo ai = new AccountInfo();
   /* reset maxPrem workaround on every fetchaccount info */
   maxPrem.set(1);
   try {
     login(account, true);
   } catch (PluginException e) {
     account.setValid(false);
     return ai;
   }
   final String space[][] =
       new Regex(
               correctedBR,
               "<td>Used space:</td>.*?<td.*?b>([0-9\\.]+) of [0-9\\.]+ (KB|MB|GB|TB)</b>")
           .getMatches();
   if ((space != null && space.length != 0) && (space[0][0] != null && space[0][1] != null))
     ai.setUsedSpace(space[0][0] + " " + space[0][1]);
   account.setValid(true);
   final String availabletraffic =
       new Regex(correctedBR, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
   if (availabletraffic != null
       && !availabletraffic.contains("nlimited")
       && !availabletraffic.equalsIgnoreCase(" Mb")) {
     availabletraffic.trim();
     // need to set 0 traffic left, as getSize returns positive result, even when negative value
     // supplied.
     if (!availabletraffic.startsWith("-")) {
       ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
     } else {
       ai.setTrafficLeft(0);
     }
   } else {
     ai.setUnlimitedTraffic();
   }
   if (account.getBooleanProperty("nopremium")) {
     ai.setStatus("Registered (free) User");
     try {
       maxPrem.set(20);
       // free accounts can still have captcha.
       totalMaxSimultanFreeDownload.set(maxPrem.get());
       account.setMaxSimultanDownloads(maxPrem.get());
       account.setConcurrentUsePossible(false);
     } catch (final Throwable e) {
       // not available in old Stable 0.9.581
     }
   } else {
     // String expire = new Regex(correctedBR,
     // "<td>Premium(\\-| )Account expires?:</td>.*?<td>(<b>)?(\\d{1,2} [A-Za-z]+
     // \\d{4})(</b>)?</td>").getMatch(2);
     // admin wants us to use this instead of the standard, as you can still access the site on
     // that expire day..
     String timeleft =
         new Regex(correctedBR, "<tr><td><b>Expires:</b></td><td>([^<]+)</td></tr><br>")
             .getMatch(0);
     if (timeleft != null) {
       String tmpdays = new Regex(timeleft, "(\\d+)\\s+days?").getMatch(0);
       String tmphrs = new Regex(timeleft, "(\\d+)\\s+hours?").getMatch(0);
       String tmpmin = new Regex(timeleft, "(\\d+)\\s+minutes?").getMatch(0);
       String tmpsec = new Regex(timeleft, "(\\d+)\\s+seconds?").getMatch(0);
       if (tmphrs == null && tmpmin == null && tmpsec == null && tmpdays == null) {
         logger.info("timeleft regexes seem to be broken");
         throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 60 * 60 * 1000l);
       } else {
         long years = 0, days = 0, hours = 0, minutes = 0, seconds = 0;
         if (tmpdays != null) days = Integer.parseInt(tmpdays);
         if (tmphrs != null) hours = Integer.parseInt(tmphrs);
         if (tmpmin != null) minutes = Integer.parseInt(tmpmin);
         if (tmpsec != null) seconds = Integer.parseInt(tmpsec);
         long timeLeft =
             ((years * 86400000 * 365)
                     + (days * 86400000)
                     + (hours * 3600000)
                     + (minutes * 60000)
                     + (seconds * 1000))
                 + System.currentTimeMillis();
         ai.setValidUntil(timeLeft);
         try {
           maxPrem.set(20);
           account.setMaxSimultanDownloads(maxPrem.get());
           account.setConcurrentUsePossible(true);
         } catch (final Throwable e) {
           // not available in old Stable 0.9.581
         }
       }
       ai.setStatus("Premium User");
     }
     if (timeleft == null) {
       ai.setExpired(true);
       account.setValid(false);
       return ai;
     }
   }
   return ai;
 }