public Holder doParse(String html, String url) { Holder holder = new Holder(); holder.url = url; Document doc = Jsoup.parse(html, url); Elements typeElement = doc.select("body > div.main_w.clearfix > div.main.clearfix > ul > li:nth-child(5) > a"); holder.dishType = typeElement.text(); Elements titleElement = doc.select( "body > div.main_w.clearfix > div.main.clearfix > div.cp_header.clearfix > div.cp_main_info_w > div.info1 > h1 > a"); holder.title = titleElement.text(); Elements methodElement = doc.select( "body > div.main_w.clearfix > div.main.clearfix > div.cp_header.clearfix > div.cp_main_info_w > div.info2 > ul > li:nth-child(1) > a"); holder.method = methodElement.text(); Elements materialElement = doc.select( "body > div.main_w.clearfix > div.main.clearfix > div.cp_body.clearfix > div.cp_body_left > div.materials > div > div.yl.zl.clearfix > ul > li > div > h4 > a"); holder.mainMaterial = materialElement.text(); Elements stepE = doc.select( "body > div.main_w.clearfix > div.main.clearfix > div.cp_body.clearfix > div.cp_body_left > div.measure > div.editnew.edit > div.content.clearfix"); // // body > div.main_w.clearfix > div.main.clearfix > div.cp_body.clearfix // > div.cp_body_left > div.measure > div.editnew.edit > // div.content.clearfix // body > div.main_w.clearfix > div.main.clearfix > div.cp_body.clearfix // > div.cp_body_left > div.measure > div.edit > p:nth-child(1) > em // if (stepE.size() == 0) { stepE = doc.select( "body > div.main_w.clearfix > div.main.clearfix > div.cp_body.clearfix > div.cp_body_left > div.measure > div.edit > p"); } for (int i = 0; i < stepE.size(); i++) { Element e = stepE.get(i); if (e.children().hasClass("step")) { String step = e.text(); if (!"".equals(step)) { holder.steps.add(step); } } } // body > div.main_w.clearfix > div.main.clearfix > div.cp_body.clearfix // > div.cp_body_left > div.measure > div.editnew.edit > // div:nth-child(1) return holder; }