Esempio n. 1
0
  public static Result textSelList(Element elsPar, ArrayList<String> jsoupSelectors) {
    Result res = new Result();
    Elements els;
    Elements elsTemp;

    els = elsPar.select(jsoupSelectors.remove(0));
    for (String sel : jsoupSelectors) {
      elsTemp = els.select(sel);
      if (elsTemp != null) els = elsTemp;
    }

    if (els == null || els.size() != 1) {
      log.error("jsoup selector on elements does not match 1");
      System.exit(1);
      return res.setContinua(false);
    }
    return res.setRetStr(els.get(0).text());
  }
Esempio n. 2
0
 public static Result text(Element elsPar, String jsoupSelector, boolean exitIfNotFound) {
   Result res = new Result();
   Elements els = elsPar.select(jsoupSelector);
   if (els == null || els.size() != 1) {
     res.setRc(RC.NOT_FOUND);
     if (exitIfNotFound) {
       res.setRc(RC.ERROR);
       res.setErrorMessage(
           "jsoup selector on elements does not match: " + jsoupSelector + "\n" + elsPar.html());
       log.error(res.getErrorMessage());
     }
     return res.setContinua(false).setRetStr("");
   }
   return res.setRetStr(els.get(0).text());
 }