Commit f3a6d2a5 by leiliangliang

更新热度标签及热度值

parent 8ae432b8
...@@ -169,14 +169,22 @@ public class WeiboHotSearchCrawler { ...@@ -169,14 +169,22 @@ public class WeiboHotSearchCrawler {
String name = cardInfo.getString("desc"); String name = cardInfo.getString("desc");
String desc_extr = cardInfo.getString("desc_extr"); String desc_extr = cardInfo.getString("desc_extr");
String heatLabel=null; String heatLabel=null;
Long hotCount =null; Long hotCount =0L;
if (!StringUtils.isEmpty(desc_extr)&&Objects.nonNull(desc_extr)){ if (!StringUtils.isEmpty(desc_extr)&&Objects.nonNull(desc_extr)){
String regEx="[^0-9]"; String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx); Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(desc_extr); Matcher m = p.matcher(desc_extr);
String num = m.replaceAll("").trim(); String num = m.replaceAll("").trim();
hotCount = Long.valueOf(num); hotCount = Long.valueOf(num);
heatLabel= desc_extr.split(" ")[0]; String[] split = desc_extr.split(" ");
if (split.length>1){
String heat= split[0].trim();
boolean flag = StringUtils.isNumeric(heat);
if (!flag){
heatLabel= split[0].trim();
}
}
} }
String iconUrl = cardInfo.getString("icon"); String iconUrl = cardInfo.getString("icon");
String icon=null; String icon=null;
...@@ -190,7 +198,7 @@ public class WeiboHotSearchCrawler { ...@@ -190,7 +198,7 @@ public class WeiboHotSearchCrawler {
if (Objects.nonNull(iconUrl)){hotSearch.setIconUrl(iconUrl);} if (Objects.nonNull(iconUrl)){hotSearch.setIconUrl(iconUrl);}
result.add(hotSearch); result.add(hotSearch);
rank++; rank++;
redisDao.addDataToSet(RedisConfig.WEIBO_HOTSEARCHIDS, name + "_微博热搜"); //redisDao.addDataToSet(RedisConfig.WEIBO_HOTSEARCHIDS, name + "_微博热搜");
} }
} else { } else {
log.info("card 数据结构为:{}", card); log.info("card 数据结构为:{}", card);
......
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