예제 #1
0
 private static void parseStatHeader(Document doc, Statistic stat) {
   Elements mainStatsTds = doc.select("div#div_ppy").select("tr").select("td");
   String picks = mainStatsTds.get(0).text().replace("picks", "").trim();
   String profit = mainStatsTds.get(1).text().replace("profit", "").trim();
   String yield = mainStatsTds.get(2).text().replace("yield", "").trim();
   stat.setPicks(NumberParser.parseInt(picks));
   stat.setProfit(NumberParser.parseInt(profit));
   stat.setYield(NumberParser.parseInt(yield));
 }
예제 #2
0
 private static void parseStatHeaderDetails(Document doc, Statistic stat) {
   Elements statsTrs = doc.select("table#id_stats").select("tr");
   for (Element tr : statsTrs) {
     Elements tds = tr.select("td");
     String name = tds.get(0).text().trim();
     String value = tds.get(1).text().trim();
     if (name != null) {
       if (name.startsWith("Win-Loss-Void")) {
         String[] values = value.split("-");
         if (values != null && values.length == 3) {
           stat.setWin(NumberParser.parseInt(values[0]));
           stat.setLose(NumberParser.parseInt(values[1]));
           stat.setVoid_(NumberParser.parseInt(values[2]));
         } else {
           logger.warn("Win-Loss-Void section doesn't contain 3 elements as expected");
         }
       } else if (name.startsWith("Stake avg")) {
         stat.setAvgStake(NumberParser.parseDouble(value));
       } else if (name.startsWith("Odd avg")) {
         stat.setAvgOdds(NumberParser.parseDouble(value));
       } else if (name.startsWith("Staked")) {
         stat.setStaked(NumberParser.parseDouble(value));
       } else if (name.startsWith("Returned")) {
         stat.setReturned(NumberParser.parseDouble(value));
       }
     }
   }
 }