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

getPost no longer returns a likes data.frame #167

Closed nlch closed 6 years ago

nlch commented 6 years ago

Hi @pablobarbera ,

I've been using the getPost() function this week and I've noticed that it no longer returns a likes data.frame.

Small example:

page <- getPage(page = "nytimes", token = in_token, n = 100, reactions = F)
id = page$id[which(page$likes_count==max(page$likes_count))]
max(page$likes_count)
post <- getPost(post = id, token = in_token, n = 100)

I'm using the most recent github version. I tried the version in the repositories and then the code throws the error mentioned in a couple of recent open issues (Error in while (n.l < n.likes & length(content$data) > 0 & !is.null(url <- content$paging$next)) { : argument is of length zero). Am I correct in assuming this is just a temporal fix to have a working function until the error with likes is resolved?

andreamamprin commented 6 years ago

Hi @nlch.

It seems that Facebook has begun to authorize this edge only to page owners.

From Graph Api Reference: "On February 5th, 2018, User information will not be included in responses unless you make the request with a Page access token. This only applies to Comments on Pages and Posts on Pages."

https://developers.facebook.com/docs/graph-api/reference/v2.12/object/reactions

BroVic commented 6 years ago

In my own case, I had the same error with getPost() from a Page of which I am an admin. I noticed that it was thrown by a post that had >500 likes. Upon upwardly adjusting the function's n argument to 1000, the function worked properly.

nlch commented 6 years ago

Nothing to do here but hope Facebook re-authorizes access again then. Thanks for the info :)