Rfacebook (version 0.6.15)

getPage: Extract list of posts from a public Facebook page

Description

getPage retrieves information from a public Facebook page. Note that information about users that have turned on the "follow" option on their profile can also be retrieved with this function.

Usage

getPage(page, token, n = 25, since = NULL, until = NULL, feed = FALSE,
  reactions = FALSE, verbose = TRUE, api = NULL)

Arguments

page
A page ID or page name.
token
Either a temporary access token created at https://developers.facebook.com/tools/explorer or the OAuth token created with fbOAuth.
n
Number of posts of page to return. Note that number can be sometimes higher or lower, depending on status of API.
since
A UNIX timestamp or strtotime data value that points to the start of the time range to be searched. For more information on the accepted values, see: http://php.net/manual/en/function.strtotime.php
until
A UNIX timestamp or strtotime data value that points to the end of the time range to be searched. For more information on the accepted values, see: http://php.net/manual/en/function.strtotime.php
feed
If TRUE, the function will also return posts on the page that were made by others (not only the admin of the page).
reactions
If TRUE, will add variables to the data frame with the total count of reactions: love, haha, wow, sad, angry.
verbose
If TRUE, will report a number of the posts retrieved.
api
API version. e.g. "v2.8". NULL is the default.

Details

This function will only return information from public pages, not users with public profiles.

The since and until parameters are applied to the updated_time field in the post objects, and not the created_time. As a result, this function might return old posts that have been updated recently.

comments_count refers to the total of comments, including nested comments (replies). It might be different from the total number of comments available through the API if some comments have been deleted.

See Also

getUsers, getPost, 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 posts on Humans of New York page, including posts by others users
# ## (not only owner of page)
#  page <- getPage(page="humansofnewyork", token=fb_oauth, feed=TRUE)
# ## Getting posts on Humans of New York page in January 2013
#  page <- getPage(page="humansofnewyork", token=fb_oauth, n=1000,
#    since='2013/01/01', until='2013/01/31')
## ---------------------------------------------

Run the code above in your browser using DataCamp Workspace