Commit 08d4afee by zhiwei

微博热搜添加区分推荐位icon字段

parent 5b2136e2
...@@ -36,11 +36,13 @@ public class HotSearchList implements Serializable{ ...@@ -36,11 +36,13 @@ public class HotSearchList implements Serializable{
private String type; //分类 private String type; //分类
private String icon; //热搜类型
public HotSearchList(){} public HotSearchList(){}
public HotSearchList(String url, String name, Integer count,Boolean hot,Integer rank,String type){ public HotSearchList(String url, String name, Integer count,Boolean hot,Integer rank,String type,String icon){
this.id = name + "_" + new Date().getTime(); this.id = name + "_" + new Date().getTime();
this.url = url; this.url = url;
this.name = name; this.name = name;
...@@ -50,6 +52,7 @@ public class HotSearchList implements Serializable{ ...@@ -50,6 +52,7 @@ public class HotSearchList implements Serializable{
this.time = new Date(); this.time = new Date();
this.day = TimeParse.dateFormartString(new Date(), "yyyy-MM-dd"); this.day = TimeParse.dateFormartString(new Date(), "yyyy-MM-dd");
this.type = type; this.type = type;
this.icon = icon;
} }
...@@ -79,6 +82,7 @@ public class HotSearchList implements Serializable{ ...@@ -79,6 +82,7 @@ public class HotSearchList implements Serializable{
+ ", day = " + day + ", day = " + day
+ ", changeCount = " + changeCount + ", changeCount = " + changeCount
+ ", type = " + type + ", type = " + type
+ ", icon = " + icon
+ "]"; + "]";
} }
...@@ -143,6 +147,18 @@ public class HotSearchList implements Serializable{ ...@@ -143,6 +147,18 @@ public class HotSearchList implements Serializable{
this.hot = hot; this.hot = hot;
} }
public Boolean getHot() {
return hot;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getDay() { public String getDay() {
return day; return day;
} }
...@@ -167,4 +183,6 @@ public class HotSearchList implements Serializable{ ...@@ -167,4 +183,6 @@ public class HotSearchList implements Serializable{
this.type = type; this.type = type;
} }
} }
...@@ -109,7 +109,6 @@ public class WeiboHotSearchCrawler { ...@@ -109,7 +109,6 @@ public class WeiboHotSearchCrawler {
String url = "https://m.weibo.cn/api/container/getIndex?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&title=%E5%BE%AE%E5%8D%9A%E7%83%AD%E6%90%9C&extparam=pos%3D0_0%26mi_cid%3D100103%26cate%3D10103%26filter_type%3Drealtimehot%26c_type%3D30&luicode=10000011&lfid=231583"; String url = "https://m.weibo.cn/api/container/getIndex?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&title=%E5%BE%AE%E5%8D%9A%E7%83%AD%E6%90%9C&extparam=pos%3D0_0%26mi_cid%3D100103%26cate%3D10103%26filter_type%3Drealtimehot%26c_type%3D30&luicode=10000011&lfid=231583";
Map<String,String> headerMap = new HashMap<>(); Map<String,String> headerMap = new HashMap<>();
headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"); headerMap.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36");
String htmlBody; String htmlBody;
try { try {
List<HotSearchList> result = new ArrayList<HotSearchList>(); List<HotSearchList> result = new ArrayList<HotSearchList>();
......
...@@ -55,6 +55,7 @@ public class WeiboHotSearchRun extends Thread{ ...@@ -55,6 +55,7 @@ public class WeiboHotSearchRun extends Thread{
doc.put("changeCount", changeCount); doc.put("changeCount", changeCount);
doc.put("rank", weiboHotSearch.getRank()); doc.put("rank", weiboHotSearch.getRank());
doc.put("type", weiboHotSearch.getType()); doc.put("type", weiboHotSearch.getType());
doc.put("icon", weiboHotSearch.getIcon());
data.add(doc); data.add(doc);
} }
weiboHotSearchDAO.addHotSearchList(data); weiboHotSearchDAO.addHotSearchList(data);
......
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