Commit 7fe19a3c by [zhangzhiwei]

修改微博热搜解析规则

parent 2c471a78
...@@ -62,11 +62,10 @@ public class WeiboHotSearchCrawler { ...@@ -62,11 +62,10 @@ public class WeiboHotSearchCrawler {
Elements elements = document.select("div#pl_top_realtimehot").select("tbody").select("tr"); Elements elements = document.select("div#pl_top_realtimehot").select("tbody").select("tr");
for(Element element : elements){ for(Element element : elements){
try { try {
String id = "http://s.weibo.com"+element.select("p.star_name").select("a").attr("href"); String id = "http://s.weibo.com"+element.select("td.td-02").select("a").attr("href");
String name = element.select("p.star_name").select("a").text(); String name = element.select("td.td-02").select("a").text();
String num = !element.select("p.star_num").text().equals("")?element.select("p.star_num").text():"0"; String num = !element.select("td.td-03").text().equals("")?element.select("td.td-03").text():"0";
int hotCount = Integer.valueOf(num); int hotCount = Integer.valueOf(num);
WeiboHotSearch hotSearch = new WeiboHotSearch(id, name, hotCount, true); WeiboHotSearch hotSearch = new WeiboHotSearch(id, name, hotCount, true);
list.add(hotSearch); list.add(hotSearch);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -27,7 +27,7 @@ public class HotSearchRun { ...@@ -27,7 +27,7 @@ public class HotSearchRun {
public static void main(String[] args) { public static void main(String[] args) {
new HotSearchRun().showTimer(); new HotSearchRun().showTimer();
new CacheListener().startListen(); new CacheListener().startListen();
new SendWeiboHotSearchRun().start(); // new SendWeiboHotSearchRun().start();
new SendZhihuHotSearchRun().start(); // new SendZhihuHotSearchRun().start();
} }
} }
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