Commit 74064b44 by chenweitao

Merge remote-tracking branch 'origin/working' into working

parents 9c03b231 29ea7f00
...@@ -73,6 +73,10 @@ public class HotSearchList implements Serializable{ ...@@ -73,6 +73,10 @@ public class HotSearchList implements Serializable{
* 热搜类型 * 热搜类型
*/ */
private String icon; private String icon;
/**
* 热度标签
*/
private String heatLabel;
/** /**
* icon地址 * icon地址
......
...@@ -165,7 +165,19 @@ public class WeiboHotSearchCrawler { ...@@ -165,7 +165,19 @@ public class WeiboHotSearchCrawler {
for (int j = 0; j < cardGroup.size(); j++) { for (int j = 0; j < cardGroup.size(); j++) {
JSONObject cardInfo = cardGroup.getJSONObject(j); JSONObject cardInfo = cardGroup.getJSONObject(j);
String name = cardInfo.getString("desc"); String name = cardInfo.getString("desc");
long hotCount = cardInfo.getLongValue("desc_extr"); String desc_extr = cardInfo.getString("desc_extr");
String heatLabel=null;
Long hotCount =null;
if (Objects.nonNull(desc_extr)){
String[] split = desc_extr.split(" ");
if (split.length>1){
heatLabel= split[0].trim();
hotCount= Long.valueOf(split[1].trim());
}else {
hotCount = cardInfo.getLongValue("desc_extr");
}
}
String iconUrl = cardInfo.getString("icon"); String iconUrl = cardInfo.getString("icon");
String icon=null; String icon=null;
if (StringUtils.isNotBlank(iconUrl)) { if (StringUtils.isNotBlank(iconUrl)) {
...@@ -174,6 +186,7 @@ public class WeiboHotSearchCrawler { ...@@ -174,6 +186,7 @@ public class WeiboHotSearchCrawler {
// String id = "http://s.weibo.com/weibo/" + URLCodeUtil.getURLEncode(name, "utf-8") + "&Refer=top"; // String id = "http://s.weibo.com/weibo/" + URLCodeUtil.getURLEncode(name, "utf-8") + "&Refer=top";
String id = cardInfo.getString("scheme"); String id = cardInfo.getString("scheme");
HotSearchList hotSearch = new HotSearchList(id, name, hotCount, hot, rank, HotSearchType.微博热搜.name(), icon, date); HotSearchList hotSearch = new HotSearchList(id, name, hotCount, hot, rank, HotSearchType.微博热搜.name(), icon, date);
hotSearch.setHeatLabel(heatLabel);
if (Objects.nonNull(iconUrl)){hotSearch.setIconUrl(iconUrl);} if (Objects.nonNull(iconUrl)){hotSearch.setIconUrl(iconUrl);}
result.add(hotSearch); result.add(hotSearch);
rank++; rank++;
......
...@@ -52,6 +52,7 @@ public class HotSearchCacheDAO { ...@@ -52,6 +52,7 @@ public class HotSearchCacheDAO {
} }
if("微博热搜".equals(hotSearch.getType())){ if("微博热搜".equals(hotSearch.getType())){
document.put("iconUrl", hotSearch.getIconUrl()); document.put("iconUrl", hotSearch.getIconUrl());
document.put("heatLabel", hotSearch.getHeatLabel());
} }
if("微博娱乐榜".equals(hotSearch.getType())){ if("微博娱乐榜".equals(hotSearch.getType())){
document.put("iconUrl", hotSearch.getIconUrl()); document.put("iconUrl", hotSearch.getIconUrl());
......
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