评论计数API Facebook Restfb Java

问题描述 投票:0回答:1

我用restfb编写了很多东西,但是我无法对评论进行计数,只有没有答案的评论,图像可以更好地说明.enter image description here

Example post comment facebook

我的代码

Post post = clienteFacebook.fetchObject(idPostagem,
                Post.class,
                Parameter.with("fields", "comments.limit(0).summary(true)"), 
                Parameter.with("filter", "toplevel"));

        System.out.println("Comments count: " + post.getCommentsCount());

Out code comments count

但是我需要从该出版物中获得实际评论,在这个例子中有57条评论。

https://developers.facebook.com/docs/graph-api/reference/v3.2/object/comments我有一些过滤器的参考 - 顶级但没有成功。

我还测试了Comment而不是Post但没有成功。

如何在帖子中获得57个帖子?

facebook-graph-api restfb facebook-java-api facebook4j
1个回答
0
投票

请尝试以下代码:

Post post = clienteFacebook.fetchObject(idPostagem,
      Post.class,Parameter.with("fields", "comments.limit(0).summary(1).filter(toplevel)"));

System.out.println("Comments count: " + post.getCommentsCount());

如您所见,过滤器是fields参数的一部分。但奇怪的是,如果没有提供过滤器,toplevel是默认过滤器。所以也许它是不同的东西。

也许您可以直接与我们联系(RestFB团队),这样我们可以更深入地帮助;)

© www.soinside.com 2019 - 2024. All rights reserved.