Rfacebook (version 0.6.15)

getPost: Extract information about a public Facebook post

Description

getPost retrieves information about a public Facebook post, including list of comments and likes.

Usage

getPost(post, token, n = 500, comments = TRUE, likes = (!reactions),
  reactions = FALSE, n.likes = n, n.comments = n, n.reactions = n,
  api = NULL)

Arguments

post
A post ID
token
Either a temporary access token created at https://developers.facebook.com/tools/explorer or the OAuth token created with fbOAuth.
n
numeric, maximum number of comments and likes to return.
comments
logical, default is TRUE, which will return data frame with comments to the post.
likes
logical, default is TRUE unless reactions is true, which will return data frame with likes for the post.
reactions
logical, default is FALSE, which will return data frame with reactions (like, love, etc) for the post
n.likes
numeric, maximum number of likes to return. Default is n.
n.comments
numeric, maximum number of comments to return. Default is n.
n.reactions
numeric, maximum number of reactions to return. Default is n.
api
API version. e.g. "v2.8". NULL is the default.

Details

getPost returns a list with up to four components: post, likes, comments, and reactions. post contains information about the post: author, creation date, id, counts of likes, comments, and shares, etc. likes is a data frame that contains names and Facebook IDs of all the users that liked the post. comments is a data frame with information about the comments to the post (author, message, creation time, id). To download also the replies to specific comments, see getCommentReplies. Note that the total number of comments may be different from the number report in comments_count if some comments have been deleted.

See Also

getUsers, getPage, fbOAuth

Examples

Run this code
## Not run: ------------------------------------
# ## See examples for fbOAuth to know how token was created.
# ## Getting information about Facebook's Facebook Page
# load("fb_oauth")
# fb_page <- getPage(page="facebook", token=fb_oauth)
# ## Getting information and likes/comments about most recent post
# post <- getPost(post=fb_page$id[1], n=2000, token=fb_oauth)
## ---------------------------------------------

Run the code above in your browser using DataCamp Workspace