@Override public void parseBoard() { Iterator<Map.Entry<String, String>> iterator = this.keyWords.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, String> entry = iterator.next(); String keyWord = entry.getKey().split(";")[0]; String transKey = ""; try { transKey = URLEncoder.encode(keyWord, "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String location = GetHTML.getHeaderValue("Location", "http://bbs.p5w.net/search.php?mod=my&q=" + transKey); String html = GetHTML.getHtml(location, "utf-8"); html = html.replaceAll(" ", ""); Document document = Jsoup.parse(html); /* 搜索关键词是否存在 */ Elements flag = document.select("div.result").select("span#result-items").select("ul").select("li"); if (flag.size() == 0) { // Todo ?? System.out.println("nothing to found....."); } else { Elements tableEles = document.select("div.result").select("span#result-items").select("ul").select("li"); ArrayList<Element> tableList = new ArrayList<Element>(); for (Element ele : tableEles) { tableList.add(ele); } parsePages(tableList, entry); } } }