拿走直接用
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.5.15</version>
</dependency>
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
public class DouYinHot {
public static void main(String[] args) {
String json = HttpUtil.get("https://aweme-hl.snssdk.com/aweme/v1/hot/search/list/");
JSONArray word_list = JSONUtil.parseObj(json).getJSONObject("data").getJSONArray("word_list");
JSONArray DouYinHotList = new JSONArray();
for (int i = 0; i < word_list.size(); i++) {
JSONObject jsonObject = word_list.getJSONObject(i);
JSONObject DouYinHot = new JSONObject();
DouYinHot.put("title", jsonObject.get("word"));
DouYinHot.put("link", "https://www.douyin.com/search/" + jsonObject.get("word"));
DouYinHot.put("hot_value", jsonObject.get("hot_value"));
DouYinHotList.add(DouYinHot);
}
System.out.println(DouYinHotList);
}
}