Commit f97d6fe2 by yangchen

头条用户采集解析修改

parent f061889a
......@@ -193,19 +193,35 @@ public class TouTiaoAccountParse {
for (int i = 0; i < jsonArray.size(); i++) {
try {
JSONObject data = jsonArray.getJSONObject(i);
System.out.println(data.toString());
if(data.getLong("id") == null) {
continue;
}
long user_id = data.getLong("id");
String name = data.getString("name");
long media_id = data.getLong("media_id");
long media_id = -1L;
if(data.getLong("media_id") != null) {
media_id = data.getLong("media_id");
}
String description = data.getString("description");
int user_verified = data.getInteger("user_verified");
int user_verified = -1;
if(data.getInteger("user_verified") != null) {
user_verified = data.getInteger("user_verified");
}
String verify_content = data.getString("verify_content");
int follow_count = data.getInteger("follow_count");
int follow_count = -1;
if(data.getInteger("follow_count") != null) {
follow_count = data.getInteger("follow_count");
}
String img_url = "https:"+data.getString("avatar_url");
System.out.println(data.getString("create_time"));
Date create_time = new Date(Long.valueOf(data.getString("create_time"))*1000);
Date create_time = null;
if(data.getString("create_time") != null) {
create_time = new Date(Long.valueOf(data.getString("create_time"))*1000);
}
String gender = data.getString("gender");
String user_type = data.getString("user_type");
if(name.equals(word)){
if(name != null && name.equals(word)){
TouTiaoAccount tta = new TouTiaoAccount(user_id, name, media_id, description, user_verified,
verify_content, follow_count,img_url,create_time, gender, user_type);
ZhiWeiTools.sleep(1000);
......
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