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;
}
任何想法都會受到歡迎。謝謝。