我用restfb编写了很多东西,但是我无法对评论进行计数,只有没有答案的评论,图像可以更好地说明.enter image description here
我的代码
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());
但是我需要从该出版物中获得实际评论,在这个例子中有57条评论。
在https://developers.facebook.com/docs/graph-api/reference/v3.2/object/comments我有一些过滤器的参考 - 顶级但没有成功。
我还测试了Comment而不是Post但没有成功。
如何在帖子中获得57个帖子?
请尝试以下代码:
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团队),这样我们可以更深入地帮助;)