Commit eb71665b by chenweitao

增加热搜推荐位识别

parent b8f83e22
...@@ -99,6 +99,11 @@ public class HotSearchList implements Serializable{ ...@@ -99,6 +99,11 @@ public class HotSearchList implements Serializable{
*/ */
private String pictureUrl; private String pictureUrl;
/**
* 图片排位
**/
private String rankPic;
public HotSearchList(){} public HotSearchList(){}
public HotSearchList(String url, String name, Long count,Boolean hot,Integer rank,String type,String icon,Date date){ public HotSearchList(String url, String name, Long count,Boolean hot,Integer rank,String type,String icon,Date date){
......
...@@ -162,9 +162,12 @@ public class WeiboHotSearchCrawler { ...@@ -162,9 +162,12 @@ public class WeiboHotSearchCrawler {
if (StringUtils.isNotBlank(icon)) { if (StringUtils.isNotBlank(icon)) {
icon = icon.split("_")[1].split(".png")[0]; icon = icon.split("_")[1].split(".png")[0];
} }
String rankPic = cardInfo.getString("pic");
// 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 urlScheme = cardInfo.getString("scheme");
HotSearchList hotSearch = new HotSearchList(id, name, hotCount, hot, rank, HotSearchType.微博热搜.name(), icon, date); HotSearchList hotSearch = new HotSearchList(urlScheme, name, hotCount, hot, rank, HotSearchType.微博热搜.name(), icon, date);
hotSearch.setRankPic(rankPic);
result.add(hotSearch); result.add(hotSearch);
rank++; rank++;
redisDao.addDataToSet(RedisConfig.WEIBO_HOTSEARCHIDS,name+"_微博热搜"); redisDao.addDataToSet(RedisConfig.WEIBO_HOTSEARCHIDS,name+"_微博热搜");
......
...@@ -43,6 +43,7 @@ public class HotSearchCacheDAO { ...@@ -43,6 +43,7 @@ public class HotSearchCacheDAO {
document.put("rank", hotSearch.getRank()); document.put("rank", hotSearch.getRank());
document.put("type", hotSearch.getType()); document.put("type", hotSearch.getType());
document.put("icon", hotSearch.getIcon()); document.put("icon", hotSearch.getIcon());
document.put("rankPic", hotSearch.getRankPic());
if("微博话题".equals(hotSearch.getType())){ if("微博话题".equals(hotSearch.getType())){
document.put("topic_lead", hotSearch.getTopicLead()); document.put("topic_lead", hotSearch.getTopicLead());
document.put("comment_count", hotSearch.getCommentCount()); document.put("comment_count", hotSearch.getCommentCount());
...@@ -94,6 +95,12 @@ public class HotSearchCacheDAO { ...@@ -94,6 +95,12 @@ public class HotSearchCacheDAO {
boolean recommend = false; boolean recommend = false;
// Integer readCount = document.getInteger("comment_count"); // Integer readCount = document.getInteger("comment_count");
if("微博热搜".equals(type)){ if("微博热搜".equals(type)){
//排位标判断 例如 https://simg.s.weibo.com/20210408_search_point_orange.png
String rankPic = document.getString("rankPic");
if (nonNull(rankPic)&&rankPic.contains("search_point")){
recommend = true;
}
//后标判断
String icon = document.getString("icon"); String icon = document.getString("icon");
if("recom".equals(icon) || "jian".equals(icon)){ if("recom".equals(icon) || "jian".equals(icon)){
recommend = true; recommend = true;
......
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