求救怎么用jsoup解析html里的head

2024-11-01 14:02:16
推荐回答(1个)
回答1:

下面的是我写了一部分的代码..
public class NewsItemBiz {
private static String url = "http://news.iciba.com/dailysentence";
public String getContent() throws Exception{
String htmlStr = GetHtml.doGet(url);
System.out.println(htmlStr);
Document doc = Jsoup.parse(htmlStr);
Element units = doc.head();
Element comm = units.child(3);
String comString = comm.attr("content");
System.out.println(comString);
return comString;