use of com.fiction.y.detail.m.DetailModel in project AndroidDevelop by 7449.
the class JsoupTool method getDetail.
public DetailModel getDetail(String url) {
Document document = getDocument(url);
DetailModel detailModel = new DetailModel();
if (document == null) {
throw new NullPointerException("the document is null");
}
Elements select = document.select("div.bottem2").select("a[href$=.html]");
for (int i = 0; i < select.size(); i++) {
switch(i) {
case 0:
detailModel.setOnPage(select.get(i).attr("abs:href"));
break;
case 1:
detailModel.setNextPage(select.get(i).attr("abs:href"));
break;
}
}
detailModel.setTitle(document.select("div.bookname").select("h1").text());
detailModel.setContent(document.select("#content").html());
KLog.i(detailModel.getOnPage() + " " + detailModel.getNextPage());
return detailModel;
}
Aggregations