import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class TestJsoup { public static void main(String[] args) throws Exception { String url = "http://epg.dishstar.net/calendar.php?s=DISC&d=1"; // Document doc = Jsoup.parse(new URL(url), 5000); Document doc = Jsoup.connect(url) .userAgent("Mozilla/5.0") .timeout(5000).get(); Elements trs = doc.select("table tr"); for (Element tr : trs) { String time = tr.select("td:eq(0)").text(); String title = tr.select("td:eq(1)").text(); System.out.println(time + " <=> " + title); } } }
2015-03-06 15:33
[Java] Jsoup 筆記
訂閱:
張貼留言 (Atom)
0 回應:
張貼留言