String url =“http://forbesindia.com/lists/2015-celebrity-100/1519/all”; print(“获取%s ...”,url);
Document doc = Jsoup.connect(url).get();
for (Element table : doc.select("table.tablesorter")) {
for (Element row : table.select("tr")) {
Elements tds = row.select("td.company");
System.out.println(tds);
}
}
请提及如何在Jsoup中遍历此类DOM树。 PS:我是初学者。
答案 0 :(得分:0)
要获取发送cell.accessoryType = .Checkmark
cell.accessoryView = UIView(frame: CGRectMake(0, 0, 20, 20)) //You can change to UIButton with your own custom checkmark button
cell.accessoryView.backgroundColor = UIColor.blueColor() //change to your color
请求所需的数据:
POST
例如:
http://forbesindia.com/celebload2015.php
输出:
Document document = Jsoup.connect("http://forbesindia.com/celebload2015.php")
.data("page_no", "all")
.data("list_id", "1519")
.data("category", "All")
.data("order", "rank")
.data("name", "")
.post();
Elements img = document.select("img");
for (Element element : img) {
System.out.println(element.attr("alt"));
System.out.println(element.absUrl("src"));
}