Commit 26dc222c by [zhangzhiwei]

微头条数据处理

parent 9e236728
......@@ -188,7 +188,7 @@ public class TouTiaoArticleParse {
logger.info("数据为null");
}
} catch (Exception e) {
logger.info("获取数据出错::{},数据为null", e.fillInStackTrace());
logger.info("获取数据出错::{},数据为null", e);
return null;
}
return null;
......@@ -246,7 +246,6 @@ public class TouTiaoArticleParse {
continue;
}
}
System.out.println(source+"========="+dataList.size());
/**验证是否有下一页数据**/
if(more){
if(max_behot_time!=null && max_behot_time!=0){
......@@ -261,7 +260,7 @@ public class TouTiaoArticleParse {
e.printStackTrace();
}
map.put("max_behot_time", max_behot_time+"");
map.put("max_behot_time", max_behot_time);
map.put("data", dataList);
return map;
......
......@@ -31,7 +31,7 @@ public class TouTiaoExample {
public static void main(String[] args) throws Exception {
long a = System.currentTimeMillis();
List<String> urlList = new ArrayList<String>();
urlList.add("5757091251");
urlList.add("23782107381");
System.out.println(urlList.size());
......@@ -39,16 +39,17 @@ public class TouTiaoExample {
for (String url : urlList) {
String mid = url;
String max_behot_time = "0";
while (true) {
Long max_behot_time = 0L;
boolean f = true;
while (f) {
Map<String, Object> dataMap = null;
dataMap = TouTiaoArticleParse.getMicroTouTiaoCrawler(mid, endTime, null, max_behot_time);
dataMap = TouTiaoArticleParse.getMicroTouTiaoCrawler(mid, endTime, null, max_behot_time+"");
if (dataMap != null) {
List<TouTiaoArticle> ttlist = (List<TouTiaoArticle>) dataMap.get("data");
max_behot_time = (String) dataMap.get("max_behot_time");
max_behot_time = (Long)dataMap.get("max_behot_time");
System.out.println(max_behot_time + "=======" + ttlist.size());
if (max_behot_time == null || ttlist.isEmpty()) {
break;
if (null == max_behot_time || ttlist.isEmpty()) {
f = false;
} else {
if (ttlist.size() > 0) {
for (TouTiaoArticle tt : ttlist) {
......
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