You can perform Facebook profile searches by calling Meta Content Library API client get()
method with the search/facebook_profiles
path. This document describes the parameters and shows how to perform basic queries by using the method.
All of the examples in this document assume you have already created a Python or R Jupyter notebook and have created a client object. See Getting started to learn more.
See Data dictionary for detailed information about the fields that are available on a Facebook profile node.
Parameter | Type | Description |
---|---|---|
| String | Keyword(s) to search for. Searches a profile's |
| List | Comma-separated list of profile fields you want included in search results. See Data dictionary for descriptions of all available fields. |
| List | Comma-separated list of categories to include in the search. |
| Boolean | The verification status of the Facebook profile. A Facebook profile with a verified badge indicates that Facebook has confirmed that it is the authentic presence for that person or brand. Learn more. |
| String | Website to match against the Facebook profile's "About" section. |
| List | Comma-separated list of Meta Content Library profile IDs as strings. Limits the query to the specified profiles. Maximum of 250 IDs. |
| List | Comma-separated list of countries by which to filter the Facebook profile's admin. Takes ISO Alpha-2 Country Code in 2-letter uppercase format. |
| String or Integer | Date in YYYY-MM-DD (date only) or UNIX timestamp (translates to a date and time to the second) format. Facebook profiles created on or after this date or timestamp are returned (used with UNTIL to define a time range). SINCE and UNTIL are based on UTC time zone, regardless of the local time zone of the user who created the profile.
|
| String or Integer | Date in YYYY-MM-DD (date only) or UNIX timestamp (translates to a date and time to the second) format. Facebook profiles created on or before this date or timestamp are returned (used with SINCE to define a time range). SINCE and UNTIL are based on UTC time zone, regardless of the local time zone of the user who created the profile.
|
To search for profiles that contain a specific use the get()
method with the q
parameter. See Advanced search guidelines for information about how multiple keyword searches are handled.
library(reticulate)
client <- import("metacontentlibraryapi")$MetaContentLibraryAPIClient
client$set_default_version(client$LATEST_VERSION)
response <- client$get(
path = "search/facebook_profiles",
params = list('q' = "cybercrime")
)
jsonlite::fromJSON(response$text, flatten=TRUE) # Display first page
# Fetch next page
if (client$has_next_page(response)) {
response <- client$query_next_page(response)
jsonlite::fromJSON(response$text, flatten=TRUE) # Display second page
}
You can use the query_next_page()
and has_next_page()
to get the next page of 10 results until all the results have been returned. See Search guide for other display and storage options.
To have the API return specific fields on any profiles in the response, include the fields
parameter and a comma-separated list of fields you want included. If omitted, default fields will be returned.
library(reticulate)
client <- import("metacontentlibraryapi")$MetaContentLibraryAPIClient
client$set_default_version(client$LATEST_VERSION)
response <- client$get(
path = "search/facebook_profiles",
params = list("q" = "cybercrime", 'fields' = "id,name")
)
jsonlite::fromJSON(response$text, flatten=TRUE) # Display first page
To search for profiles with specific profile IDs (obtained from the results of previous profile searches), use get()
method with the profile_ids
parameter.
response <- client$get(
path = "search/facebook_profiles",
params = list("page_ids" = list('755732639815385'), 'fields' = "id,name")
)
jsonlite::fromJSON(response$text, flatten=TRUE) # Display first page
For using profile IDs to search for posts from specific Facebook profiles, see Guide to Facebook posts data.