0
我正在使用RestFB从facebook页面获取帖子。问题是我只想要该页面的最新帖子,比方说,上个月的帖子。使用我的代码,我可以获得所有历史记录,并且需要很长时间。 我该怎么做?我没有阅读关于“时间戳”参数的信息。我已经尝试使用极限参数,但没有很好的结果。使用RestFB获取Facebook的最新帖子
我的代码是:
public static JSONArray GetPostsFromPage(String idpage) {
String texto, idpost;
Date timestamp;
JSONArray array = new JSONArray();
JSONObject objeto;
Connection<Post> postFeed = fbClient.fetchConnection(idpage + "/feed", Post.class, Parameter.with("limit", 50));
for (List<Post> postPage : postFeed) {
for (Post aPost : postPage) {
objeto = new JSONObject();
idpost = aPost.getId();
texto = aPost.getMessage();
timestamp = aPost.getCreatedTime();
objeto.put("id", idpost);
objeto.put("texto", texto);
objeto.put("timestamp", timestamp);
array.put(objeto);
}
}
return array;
}
任何想法都会受到欢迎。谢谢。