Rfacebook (version 0.6.15)

searchFacebook: Search public posts that mention a string

Description

searchFacebook retrieves public status updates that mention a given keyword

Usage

searchFacebook(string, token, n = 200, since = NULL, until = NULL)

Arguments

string
string or string vector containing keywords to search. Note that the returned results will contain any of the keywords. It is not possible to search for status updates that include all of the keywords.
token
An OAuth token created with fbOAuth. Only tokens created for version 1.0 of the Facebook Graph API will return results.
n
Maximum number of posts to return.
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

Details

Note: Public post search was deprecated with version 2.0 of the Facebook Graph API, and therefore this function will no longer work. For more information about these changes, go to: https://developers.facebook.com/docs/apps/changelog

The function will only work for OAuth tokens generated with version 1.0 of the API, which can no longer be created.

The search is performed also on the text of the comments too, which explains why some of the returned messages do not mention the string that is being searched.

Note that only messages up to around two weeks old or less can be returned.

See Also

fbOAuth

Examples

Run this code
## Not run: ------------------------------------
# ## Searching 100 public posts that mention "facebook"
# posts <- searchFacebook( string="facebook", token=fb_oauth, n=100 )
# ## Searching 100 public posts that mention "facebook" from yesterday
# posts <- searchFacebook( string="facebook", token=fb_oauth, n=100,
#    since = "yesterday 00:00", until = "yesterday 23:59" )
## ---------------------------------------------

Run the code above in your browser using DataCamp Workspace