java利用hutool中的HttpUtil工具类进行一个简单的爬虫
`
package com.rrk.user.center.controller;
import cn.hutool.http.HttpUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
public class DemoController {
public static void main(String[] args) {
String url = "http://www.shuoshuokong.com/gexing/4902.html";
String getResult = HttpUtil.createGet(url)
.execute()
//返回参数格式utf-8
.charset("utf-8")
.body();
Document document = Jsoup.parse(getResult);
Elements postList = document.getElementsByClass("g-detail-font");
System.out.println(postList.text());
}
}`