如下代码:
String url = "http://www.114best.com/tel";
String cssQuery = ".tel tr";
String key = "";
try {
Document document = Jsoup.connect(url).userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31").get();
Elements elements = document.select(cssQuery);
Map
不过,要运行其代码并成功拿到数据,需要添加相应的jar包即可,如下图:
运行结果: