Beispiel #1
0
  public static void matchDetails(String URL, String JdName) {

    String title;
    String subtitle;
    String contenturl;
    String cfNum = "";
    String cfName = "";

    String detailPage = visitPageAndGet(URL);
    Document page = Jsoup.parse(detailPage);
    Elements contents = page.select("div.aggregation_content");
    int i = 1;
    for (Element ele : contents) {
      // 大标题
      title = ele.select("h2.aggregation_title").first().text();

      Elements subcontents = ele.select("li.flag_product");
      for (Element subcontent : subcontents) {

        Element firsta = subcontent.select("a").first();

        if (firsta != null) {
          subtitle = firsta.text();
          title = title + "·" + subtitle;
          // http://vacations.ctrip.com/grouptravel/p3699856s158.html
          contenturl = "http://vacations.ctrip.com/" + subcontent.attr("data-href");
          Matcher matcher = XC.numPattern.matcher(contenturl);
          if (matcher.find()) {
            cfNum = matcher.group(1);
          }
          cfName = jedisCluster.hget(XC.GnCfKey, cfNum);
        } else { // 没有小标题

        }
      }
    }
  }