2019独角兽企业重金招聘Python工程师标准>>>
Document doc;try {String URL = "www.baidu.com";doc = Jsoup.connect(URL).get();Elements ElementsUl = doc.getElementsByTag("ul");for (Element elementLi : ElementsUl) {Elements provinceEl = elementLi.getElementsByTag("li");for (Element element : provinceEl) {String categroyName = element.text();Element el = element.select("a").first();String url = el != null ? el.attr("href") : "";String letter = PinYinUtils.convertUpper(categroyName);letter = letter.substring(0, 1);categroyName = ReplaceUtils.replaceBrackets(categroyName);categroyName = ReplaceUtils.removeDigital(categroyName);System.out.println(categroyName);System.out.println(url);System.out.println(letter);insert(letter, categroyName, url);}}} catch (Exception e) {e.printStackTrace();}