Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Facebook4j在过去两周内获得的帖子是否有限?_Java_Facebook Graph Api - Fatal编程技术网

Java Facebook4j在过去两周内获得的帖子是否有限?

Java Facebook4j在过去两周内获得的帖子是否有限?,java,facebook-graph-api,Java,Facebook Graph Api,当我试图获取一个用户使用Facebook4j流在他的墙上发布的所有Facebook帖子时,我似乎只能获取过去14天的帖子。有没有办法绕过这一限制,让用户在墙上张贴的每一条信息都能看到 我正在使用分页,在过去的两周内收到了550条消息,但不超过这一点 这是我的密码 private void printFBMessages(FileWriter fileWriter, String nameFeed) throws InterruptedException, IOException,

当我试图获取一个用户使用Facebook4j流在他的墙上发布的所有Facebook帖子时,我似乎只能获取过去14天的帖子。有没有办法绕过这一限制,让用户在墙上张贴的每一条信息都能看到

我正在使用分页,在过去的两周内收到了550条消息,但不超过这一点

这是我的密码

private void printFBMessages(FileWriter fileWriter, String nameFeed)
        throws InterruptedException, IOException, FacebookException {
    int n = 0;
    boolean notEmpty = true;
    while (notEmpty) {
        try {
            notEmpty = false;
            System.out.println("N: " + n);
            for (Post post : facebook.getFeed(nameFeed, new Reading().limit(100).offset(n))) {
                notEmpty = true;
                MessageInfo msg = new MessageInfo();
                msg.setDate(post.getCreatedTime().toString());
                msg.setTitle(post.getMessage());
                System.out.println(msg);
                n++;

                addControleToResult(fileWriter, nameFeed, msg);
            }
            if (!notEmpty) {
                System.out.println("Empty");
            }
        } catch (FacebookException ex) {
            System.out.println(ex.getMessage());
            Thread.sleep(300000);
        }
        n++;
    }
    System.out.println("Done!");
    return;
}

看来我处理分页错误了,这就是为什么它没有按预期工作的原因

这是一个实际按预期工作的代码示例:

private void printFBMessages(FileWriter fileWriter, String nameFeed)
        throws InterruptedException, IOException, FacebookException {
    boolean notEmpty = true;

    facebook4j.ResponseList<Post> posts = facebook.getFeed(nameFeed, new Reading().limit(100));

    while (notEmpty) {
        try {
            notEmpty = false;

            for (Post post : posts) {
                notEmpty = true;
                MessageInfo msg = new MessageInfo();
                msg.setDate(post.getCreatedTime().toString());
                msg.setTitle(post.getMessage());
                System.out.println(msg);

                addControleToResult(fileWriter, nameFeed, msg);
            }               
            posts = facebook.fetchNext(posts.getPaging());
        } catch (FacebookException ex) {
            System.out.println(ex.getMessage());
            Thread.sleep(300000);
        }
    }
    System.out.println("Done!");
    return;
}