R: Extract list of posts from a public Facebook page
getPage
R Documentation
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 = 80, since = NULL, until = NULL, feed = FALSE)
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).
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.
## 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')
## End(Not run)