Learn R Programming

Rfacebook (version 0.6.15)

getShares: Extract list of users who publicly shared a public Facebook post

Description

getShares retrieves a list of posts that correspond to shares of a post on a public Facebook page. Only public posts by users who have granted authorization to the app used to authenticate.

Usage

getShares(post, token, n = 100)

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 shares to return.

Details

getShares returns a data frame with four variables: from_name (the name of the user who shared the post), from_id (the ID of the user who shared the post), shared_time (the time at which the post was shared), and id (the ID of the new post).

For more information on why not all shared posts are returned, see here: https://developers.facebook.com/bugs/1404733043148335/

See Also

getPage, getPost

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 shares of most recent post
# shares <- getShares(post=fb_page$id[1], n=2000, token=fb_oauth)
## ---------------------------------------------

Run the code above in your browser using DataLab