下边是该爬虫的例子
链接:https://pan.baidu.com/s/1pM54wxP 密码:9q2n
下边是这个方法实现的main方法,连接地址是具体的实例工程,
public static void main(String[] args) {
String url = "http://m.dianping.com/tuan/deal/13768558?utm_source=appshare";try {
@SuppressWarnings("resource")
WebClient webClient = new WebClient(BrowserVersion.CHROME);
System.out.println("HTMLUnit.main()");
//设置webClient的相关参数
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setCssEnabled(false);
//webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.getOptions().setTimeout(1000);
//webClient.