Connect to Facebook Graph API, get information from a list of Facebook comments to posts and build a
1 2 3 4 5
A character vector or a comma-delimited string of IDs or an existing Facebook Collection of any of the supported types (see below).
Either a temporary access token created at
https://developers.facebook.com/tools/explorer or the OAuth token
A list of parameters to be added to the Facebook Graph API query. For more information on the accepted parameters, see: https://developers.facebook.com/docs/graph-api/using-graph-api.
A character vector with the fields to get for each
If set to
progress_bar object as defined in the plyr package.
By default the
anonymous function that is executed for each element of the collection, passed to the function as a list called 'x'. If the function returns
FacebookCommentsCollection is the constructor for the
It returns data about comments but doesn't return lists of their own comments or likes,
although it does return an approximate total count for both (depending on the privacy settings of the users).
A collection of comments in a
Due to the network-graph nature of Facebook data model,
you can specify fields details for each field nesting
For example, if you need only
source for the
cover field, this is valid among others:
Following the same philosophy, if you need only
name for the
you can use
Instead of a character vector, one of these collections can also be passed as parameter in
FacebookPostsCollection-class will build a collection with
the comments to the posts in the source collection.
FacebookPhotosCollection-class will build a collection with
the comments to the photos in the source collection. The author of the photo may grant the
user_photos to the current application to perform this action.
FacebookVideosCollection-class will build a collection with
the comments to the videos in the source collection. The author of the photo may grant the
user_videos to the current application to perform this action.
FacebookCommentsCollection-class will build a collection with
the replies to the comments in the source collection.
FacebookEventsCollection-class will build a collection with
the comments to the events in the source collection.
Gabriele Baldassarre https://gabrielebaldassarre.com
Other Facebook Collection Constructors:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
## Not run: ## See examples for fbOAuth to know how token was created. load("fb_oauth") ## Getting information about two example Facebook Pages fb.pages <- FacebookPagesCollection(id = c("9thcirclegames", "NathanNeverSergioBonelliEditore"), token = fb_oauth) ## Pull the latest 10 posts from each page in a post collection fb.posts <- FacebookPostscollection(id = fb.pages, token = fb_oauth, n = 10) ## Pull all the available posts from each page in a post collection fb.posts.inf <- FacebookPostscollection(id = fb.pages, token = fb_oauth, n = Inf) ## Pull all the available comments from each post of the first collection fb.comments.inf <- FacebookPostscollection(id = fb.posts, token = fb_oauth) ## Convert the collection to a data frame fb.comments <- as.data.frame(fb.comments) # The same as before in a more compact fashion using the pipe operator # chaining first from a pages and then a posts collection fb.comments.pipe <- FacebookPagesCollection(id = c("9thcirclegames", "NathanNeverSergioBonelliEditore"), token = fb_oauth) %>% FacebookPostscollection(n = 10) %>% FacebookCommentsCollection(n = Inf) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.