Query and return all available content in the API.
See the API docs for full details on the query options available for this content endpoint.
gu_content(query = NULL, show_fields = "all", show_tags = "all",
tag = NULL, from_date = NULL, to_date = NULL,
use_date = "published", ..., verbose = TRUE, tidy = TRUE,
tidy_style = "snake_case")A string, containing the search query. Defaults to NULL,
which returns all available content subject to other parameters.
Supports AND, OR and NOT operators, and exact phrase queries
using double quotes. E.g. '"football" OR "politics"'.
A string or character vector of fields to include in
the returned data. Defaults to "all". See details for a list of options.
A string or character vector of tags to include in
the returned data. Defaults to "all". See details for a list of options.
A string or character vector of tags to filter
the returned data. Defaults to NULL.
Accepts character values in 'YYYY-MM-DD'
format, and objects of class Date, POSIXt, POSIXct,
POSIXlt or anything else that can be coerced to a date with
as.Date(). Defaults to NULL.
Accepts character values in 'YYYY-MM-DD'
format, and objects of class Date, POSIXt, POSIXct,
POSIXlt or anything else that can be coerced to a date with
as.Date(). Defaults to NULL.
The date type to use for the from_date and to_date
parameters. One of "published", "first-publication",
"newspaper-edition" or "last-modified". Defaults to "published".
Use to pass any other parameters to the API. See the docs for a full list of options.
Prints messages to console. Defaults to TRUE.
Convert variable names to snake_case, remove some "<NA>"
strings. Defaults to TRUE.
Style to variable names with.
A tibble.
The following are the options for the show_fields parameter:
"all" Includes all the fields (default)
"trailText"
"headline"
"showInRelatedContent" Whether this content can appear in automatically
generated Related Content
"body"
"lastModified"
"hasStoryPackage" Has related content selected by editors
"score" A relevance score based on the search query used
"standfirst"
"shortUrl"
"thumbnail"
"wordcount"
"commentable"
"isPremoderated" Comments will be checked by a moderator prior to
publication if true.
"allowUgc" May have associated User Generated Content. This typically
means the content has an associated Guardian Witness assignment
which can be accessed by querying "show-references=witness-assignment",
using the query parameter.
"byline"
"publication"
"internalPageCode"
"productionOffice"
"shouldHideAdverts" Adverts will not be displayed if true
"liveBloggingNow" Content is currently live blogged if true
"commentCloseDate" The date the comments have been closed
"starRating"
if (FALSE) {
x <- gu_content(query = "films")
y <- gu_content(
query = "relationships",
from_date = "2018-11-30", to_date = "2018-12-30"
)
}