Commit 88c7942a by chenweitao

Merge branch 'mlbWork' into 'master'

今日头条链接

See merge request !39
parents 7075b291 a98a48ca
...@@ -52,11 +52,8 @@ public class ToutiaoHotSearchCrawler { ...@@ -52,11 +52,8 @@ public class ToutiaoHotSearchCrawler {
} }
//采集头条内容 //采集头条内容
String url = "https://i.snssdk.com/hot-event/hot-board/?origin="+origin; String url = "https://i.snssdk.com/hot-event/hot-board/?origin="+origin;
Map<String,String> headerMap = new HashMap<>();
headerMap.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1");
headerMap.put("referer","https://ib.snssdk.com/rogue/aladdin_landingpage/template/aladdin_landingpage/hot_words.html?isBrowser=true&traffic_source=");
String htmlBody = null; String htmlBody = null;
Request request = RequestUtils.wrapGet(url, headerMap); Request request = RequestUtils.wrapGet(url);
for(int count =0; count<=5; count++){ for(int count =0; count<=5; count++){
try(Response response = httpBoot.syncCall(request)) { try(Response response = httpBoot.syncCall(request)) {
htmlBody = response.body().string(); htmlBody = response.body().string();
...@@ -72,7 +69,8 @@ public class ToutiaoHotSearchCrawler { ...@@ -72,7 +69,8 @@ public class ToutiaoHotSearchCrawler {
try { try {
JSONObject word = words.getJSONObject(i); JSONObject word = words.getJSONObject(i);
String name = word.getString("Title"); String name = word.getString("Title");
String link = "https://ib.snssdk.com/search/?keyword=" + URLCodeUtil.getURLEncode(name, "utf-8") + "&pd=synthesis&source=trending_list&traffic_source="; // String link = "https://ib.snssdk.com/search/?keyword=" + URLCodeUtil.getURLEncode(name, "utf-8") + "&pd=synthesis&source=trending_list&traffic_source=";
String link = word.getString("Url");
Integer hotCount = word.getInteger("HotValue"); Integer hotCount = word.getInteger("HotValue");
String wordsType = word.getString("Label"); String wordsType = word.getString("Label");
String icon = getIcon(wordsType); String icon = getIcon(wordsType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment