Commit fd08d8f7 by chenweitao

Merge branch 'working' into 'master'

list表新增微博iconUrl字段   修复weibo_user粉丝量采集异常情况

See merge request !124
parents 12c815c2 ab081ccd
......@@ -75,6 +75,11 @@ public class HotSearchList implements Serializable{
private String icon;
/**
* icon地址
*/
private String iconUrl;
/**
* 话题讨论量或阅读量
*/
private Long commentCount;
......
......@@ -166,13 +166,15 @@ public class WeiboHotSearchCrawler {
JSONObject cardInfo = cardGroup.getJSONObject(j);
String name = cardInfo.getString("desc");
long hotCount = cardInfo.getLongValue("desc_extr");
String icon = cardInfo.getString("icon");
if (StringUtils.isNotBlank(icon)) {
icon = icon.split("_")[1].split(".png")[0];
String iconUrl = cardInfo.getString("icon");
String icon=null;
if (StringUtils.isNotBlank(iconUrl)) {
icon = iconUrl.split("_")[1].split(".png")[0];
}
// String id = "http://s.weibo.com/weibo/" + URLCodeUtil.getURLEncode(name, "utf-8") + "&Refer=top";
String id = cardInfo.getString("scheme");
HotSearchList hotSearch = new HotSearchList(id, name, hotCount, hot, rank, HotSearchType.微博热搜.name(), icon, date);
if (Objects.nonNull(iconUrl)){hotSearch.setIconUrl(iconUrl);}
result.add(hotSearch);
rank++;
redisDao.addDataToSet(RedisConfig.WEIBO_HOTSEARCHIDS, name + "_微博热搜");
......@@ -513,8 +515,13 @@ public class WeiboHotSearchCrawler {
Long followerCount = null;
if (followers_count.contains("万")) {
String[] split = followers_count.split("万");
followerCount = Long.valueOf(split[0]) * 10000;
} else {
Double aDouble = Double.valueOf(split[0])*10000;
followerCount = new Double(aDouble).longValue();
} else if (followers_count.contains("亿")){
String[] split = followers_count.split("亿");
Double aDouble = Double.valueOf(split[0])*100000000;
followerCount = new Double(aDouble).longValue();
}else {
followerCount = Long.valueOf(followers_count);
}
//用户头像地址
......
......@@ -50,6 +50,9 @@ public class HotSearchCacheDAO {
document.put("topic_lead", hotSearch.getTopicLead());
document.put("comment_count", hotSearch.getCommentCount());
}
if("微博热搜".equals(hotSearch.getType())){
document.put("iconUrl", hotSearch.getIconUrl());
}
// if("今日头条热搜".equals(hotSearch.getType())){
// document.put("comment_count", hotSearch.getCommentCount());
// }
......
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