Last data update: 2014.03.03

R: Extract list of posts from a public Facebook page
getPageR 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)

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).

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.

Author(s)

Pablo Barbera pablo.barbera@nyu.edu

See Also

getUsers, getPost, fbOAuth

Examples

## 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)

Results