get_headlines_all {newsanchor} | R Documentation |
Returns all headlines from newsapi.org
Description
get_headlines
returns live top and breaking headlines for a country,
specific category in a country, single source, or multiple sources. You can
also search with keywords. Articles are sorted by the earliest date
published first. To automatically download all results, use
get_headlines_all
.
Please check that the api_key is available. You can provide an explicit
definition of the api_key or use set_api_key
Valid searchterms are provided in terms_category
,
terms_country
or terms_sources
Usage
get_headlines_all(query = NULL, category = NULL, country = NULL,
sources = NULL, api_key = Sys.getenv("NEWS_API_KEY"))
Arguments
query |
Character string that contains the searchterm |
category |
Category you want headlines from |
country |
Country you want headlines for |
sources |
Character string with IDs (comma separated) of the news outlets you want to focus on (e.g., "usa-today, spiegel-online"). |
api_key |
Character string with the API key you get from newsapi.org.
Passing it is compulsory. Alternatively, function can be
provided from the global environment (see |
Value
List with two dataframes:
1) Data frame with results_df
2) Data frame with meta_data
Examples
## Not run:
df <- get_headlines_all(query = "sports")
df <- get_headlines_all(category = "health")
## End(Not run)