Commit 76e4f01b by 马黎滨

新浪热榜采集更新+微博封面图更新

parent c06c9268
...@@ -58,7 +58,13 @@ public class XinLangHotSearchCrawler { ...@@ -58,7 +58,13 @@ public class XinLangHotSearchCrawler {
Integer rank = i + 1; Integer rank = i + 1;
String hotValue = jsonArray.getJSONObject(i).getString("hotValue"); String hotValue = jsonArray.getJSONObject(i).getString("hotValue");
Integer count = TipsUtils.getHotCount(hotValue); Integer count = TipsUtils.getHotCount(hotValue);
String showTags = jsonArray.getJSONObject(i).getString("showTags"); String showTags;
if (jsonArray.getJSONObject(i).containsKey("card")){
JSONArray cardArray = jsonArray.getJSONObject(i).getJSONArray("card");
showTags= cardArray.getJSONObject(0).getString("showTags");
}else {
showTags = jsonArray.getJSONObject(i).getString("showTags");
}
String routeUri = jsonArray.getJSONObject(i).getString("routeUri"); String routeUri = jsonArray.getJSONObject(i).getString("routeUri");
String xinLangUrl = null; String xinLangUrl = null;
if (routeUri.contains("groupId")) { if (routeUri.contains("groupId")) {
...@@ -68,6 +74,7 @@ public class XinLangHotSearchCrawler { ...@@ -68,6 +74,7 @@ public class XinLangHotSearchCrawler {
xinLangUrl = "https://m.so.com/s?q="+ URLCodeUtil.getURLEncode(name, "utf-8")+"&src=dfttrc&srcg=sina_shoulang_act"; xinLangUrl = "https://m.so.com/s?q="+ URLCodeUtil.getURLEncode(name, "utf-8")+"&src=dfttrc&srcg=sina_shoulang_act";
} }
String icon = null; String icon = null;
if(Objects.nonNull(showTags)) {
if (showTags.contains("新")) { if (showTags.contains("新")) {
icon = "新"; icon = "新";
} else if (showTags.contains("热")) { } else if (showTags.contains("热")) {
...@@ -75,6 +82,7 @@ public class XinLangHotSearchCrawler { ...@@ -75,6 +82,7 @@ public class XinLangHotSearchCrawler {
} else if (showTags.contains("沸")) { } else if (showTags.contains("沸")) {
icon = "沸"; icon = "沸";
} }
}
HotSearchList hotSearchList = new HotSearchList(xinLangUrl, name, count, true, rank, HotSearchType.新浪热榜.name(), icon, date); HotSearchList hotSearchList = new HotSearchList(xinLangUrl, name, count, true, rank, HotSearchType.新浪热榜.name(), icon, date);
hotSearchLists.add(hotSearchList); hotSearchLists.add(hotSearchList);
} }
......
...@@ -329,6 +329,9 @@ public class HotSearchCacheDAO { ...@@ -329,6 +329,9 @@ public class HotSearchCacheDAO {
nowDoc.put("readCount", document.getInteger("readCount")); nowDoc.put("readCount", document.getInteger("readCount"));
nowDoc.put("discussCount", document.getInteger("discussCount")); nowDoc.put("discussCount", document.getInteger("discussCount"));
} }
if(document.containsKey("pictureUrl")){
nowDoc.put("pictureUrl",document.getString("pictureUrl"));
}
collection.replaceOne(query, nowDoc); collection.replaceOne(query, nowDoc);
} }
} }
......
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