pablobarbera / Rfacebook

Dev version of Rfacebook package: Access to Facebook API via R
http://cran.r-project.org/web/packages/Rfacebook
350 stars 250 forks source link

Different totals for comments #104

Closed RobertMyles closed 7 years ago

RobertMyles commented 7 years ago

An irritating quirk of the facebook API you might want to be aware of (nothing to do with the package, I'm not sure why it's happening, maybe posts have been deleted, etc).

When I run getPage() for the public page of a Brazilian senator and then a loop with getPost() inside it, I end up with different numbers for the total comments. I ran a check:

cristo <- getPage(page = "166860353356903", token = fb_oauth, 
              n = 5000, reactions = T, since = '2014/01/01', 
              until='2016/12/31')

then select a post to check, for example 166860353356903_10152317609257652, line 6. We get a different number than with getPost():

> cristo$comments_count[6]
 [1] 15

xx <- getPost("166860353356903_664277543615179", fb_oauth)
> nrow(xx$comments)
[1] 14

Looking at the actual post, I can see the reason for the problem. Underneath the post, it says "15 comments", but if you actually count them, there are 14.

Any ideas for avoiding this problem?

EDIT: it seems to be down to deletions by page administrators. Maybe a note in the documentation could explain that this can potentially happen.

pablobarbera commented 7 years ago

Thanks for reporting this! First time I hear about this issue. I wonder if it could also be FB admins shadow banning specific users? In any case, I added a note in the documentation to warn that this can happen.