Commit 84ce86e8 by 马黎滨

Merge branch 'mlb-template-local' into 'mlbWork'

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

See merge request !67
parents ccb11676 76e4f01b
......@@ -58,7 +58,13 @@ public class XinLangHotSearchCrawler {
Integer rank = i + 1;
String hotValue = jsonArray.getJSONObject(i).getString("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 xinLangUrl = null;
if (routeUri.contains("groupId")) {
......@@ -68,12 +74,14 @@ public class XinLangHotSearchCrawler {
xinLangUrl = "https://m.so.com/s?q="+ URLCodeUtil.getURLEncode(name, "utf-8")+"&src=dfttrc&srcg=sina_shoulang_act";
}
String icon = null;
if (showTags.contains("新")) {
icon = "新";
} else if (showTags.contains("热")) {
icon = "热";
} else if (showTags.contains("沸")) {
icon = "沸";
if(Objects.nonNull(showTags)) {
if (showTags.contains("新")) {
icon = "新";
} else if (showTags.contains("热")) {
icon = "热";
} else if (showTags.contains("沸")) {
icon = "沸";
}
}
HotSearchList hotSearchList = new HotSearchList(xinLangUrl, name, count, true, rank, HotSearchType.新浪热榜.name(), icon, date);
hotSearchLists.add(hotSearchList);
......
......@@ -329,6 +329,9 @@ public class HotSearchCacheDAO {
nowDoc.put("readCount", document.getInteger("readCount"));
nowDoc.put("discussCount", document.getInteger("discussCount"));
}
if(document.containsKey("pictureUrl")){
nowDoc.put("pictureUrl",document.getString("pictureUrl"));
}
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