Commit 67a6c8f2 by yangchen

修改部分 评论返回数据

parent 0709d18e
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.zhiwei</groupId>
<artifactId>articlenewscrawler</artifactId>
<version>0.0.2-SNAPSHOT</version>
<version>0.0.3-SNAPSHOT</version>
<name>articlenewscrawler</name>
<description>采集凤凰,一点资讯,搜狐历时文章和文章评论</description>
......@@ -36,7 +36,7 @@
<dependency>
<groupId>com.zhiwei.tools</groupId>
<artifactId>zhiwei-tools</artifactId>
<version>0.0.8-SNAPSHOT</version>
<version>0.0.9-SNAPSHOT</version>
</dependency>
</dependencies>
......
......@@ -49,8 +49,7 @@ public class QicheHome {
}
}
}
return Collections.emptyList();
return bodyList;
}
}
......@@ -55,6 +55,7 @@ public class SinaKeji {
logger.error("新浪科技评论采集出错 {}",e);
}
}
return dataList;
}
return Collections.emptyList();
}
......
......@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.tools.timeparse.TimeExtraction;
import com.zhiwei.tools.timeparse.TimeParse;
public class AikaCommentAnalysis {
......@@ -32,7 +33,13 @@ public class AikaCommentAnalysis {
map.put("source", data.getString("user_name"));
map.put("like", data.getString("ups"));
String time = data.getString("pub_time");
map.put("time", new Date(TimeExtraction.parseFormatTime(time, "MM dd")));
Date date = null;
if(time.contains("前")) {
date = TimeParse.stringFormartDate(time);
}else {
date = new Date(TimeExtraction.parseFormatTime(time, "MM dd"));
}
map.put("time", date!=null?date:new Date());
dataList.add(map);
}
......
......@@ -46,10 +46,14 @@ public class FenghuangCommentAnalysis {
for(int i = 0;i < 3;i++) {
try {
String result = HttpClient.executeHttpRequestGet(url,proxy, null);
if(result.contains("commentUrl")) {
if(result.contains("commentUrl\": \"")) {
docUrl = result.split("commentUrl\": \"")[1].split("\",")[0];
break;
}
if(result.contains("commentUrl\":\"")) {
docUrl = result.split("commentUrl\":\"")[1].split("\",")[0];
break;
}
} catch (Exception e) {
logger.error("解析连接出错 {}",e);
}
......
......@@ -29,7 +29,7 @@ public class SinaKejiCommentAnalysis {
map.put("source", data.getString("nick"));
map.put("like", data.getString("agree"));
map.put("location", data.getString("area"));
map.put("id", data.getString("status_cmnt_mid"));
map.put("id", data.getString("mid"));
dataList.add(map);
}
return dataList;
......
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