Commit 71498213 by leiliangliang

新增list表微博娱乐榜iconUrl字段

parent 8303240a
...@@ -57,14 +57,16 @@ public class WeiboEntertainmentCrawler { ...@@ -57,14 +57,16 @@ public class WeiboEntertainmentCrawler {
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"); long hotCount = cardInfo.getLongValue("desc_extr");
String icon = cardInfo.getString("icon"); String iconUrl = cardInfo.getString("icon");
if (StringUtils.isNotBlank(icon)) { String icon =null;
icon = icon.split("_")[1].split(".png")[0]; if (StringUtils.isNotBlank(iconUrl)) {
icon = iconUrl.split("_")[1].split(".png")[0];
} }
String id = cardInfo.getString("scheme"); String id = cardInfo.getString("scheme");
String ul="https://m.weibo.cn/search?"+id.split( "[?]")[1]; String ul="https://m.weibo.cn/search?"+id.split( "[?]")[1];
rank++; rank++;
HotSearchList hotSearch = new HotSearchList(ul, name, hotCount, hot, rank, HotSearchType.微博娱乐榜.name(), icon, date); HotSearchList hotSearch = new HotSearchList(ul, name, hotCount, hot, rank, HotSearchType.微博娱乐榜.name(), icon, date);
if (Objects.nonNull(iconUrl)){hotSearch.setIconUrl(iconUrl);}
if(!"娱乐动态数据详情".equals(hotSearch.getName())){ if(!"娱乐动态数据详情".equals(hotSearch.getName())){
result.add(hotSearch); result.add(hotSearch);
} }
......
...@@ -53,6 +53,9 @@ public class HotSearchCacheDAO { ...@@ -53,6 +53,9 @@ public class HotSearchCacheDAO {
if("微博热搜".equals(hotSearch.getType())){ if("微博热搜".equals(hotSearch.getType())){
document.put("iconUrl", hotSearch.getIconUrl()); document.put("iconUrl", hotSearch.getIconUrl());
} }
if("微博娱乐榜".equals(hotSearch.getType())){
document.put("iconUrl", hotSearch.getIconUrl());
}
// if("今日头条热搜".equals(hotSearch.getType())){ // if("今日头条热搜".equals(hotSearch.getType())){
// document.put("comment_count", hotSearch.getCommentCount()); // document.put("comment_count", hotSearch.getCommentCount());
// } // }
......
...@@ -57,14 +57,16 @@ public class WeiboEntertainmentCrawlerTest { ...@@ -57,14 +57,16 @@ public class WeiboEntertainmentCrawlerTest {
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"); long hotCount = cardInfo.getLongValue("desc_extr");
String icon = cardInfo.getString("icon"); String iconUrl = cardInfo.getString("icon");
if (StringUtils.isNotBlank(icon)) { String icon =null;
icon = icon.split("_")[1].split(".png")[0]; if (StringUtils.isNotBlank(iconUrl)) {
icon = iconUrl.split("_")[1].split(".png")[0];
} }
String id = cardInfo.getString("scheme"); String id = cardInfo.getString("scheme");
String ul="https://m.weibo.cn/search?"+id.split( "[?]")[1]; String ul="https://m.weibo.cn/search?"+id.split( "[?]")[1];
rank++; rank++;
HotSearchList hotSearch = new HotSearchList(ul, name, hotCount, hot, rank, HotSearchType.微博娱乐榜.name(), icon, date); HotSearchList hotSearch = new HotSearchList(ul, name, hotCount, hot, rank, HotSearchType.微博娱乐榜.name(), icon, date);
if (Objects.nonNull(iconUrl)){hotSearch.setIconUrl(iconUrl);}
if(!"娱乐动态数据详情".equals(hotSearch.getName())){ if(!"娱乐动态数据详情".equals(hotSearch.getName())){
result.add(hotSearch); result.add(hotSearch);
} }
......
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