Description Usage Arguments Value Examples
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
1 2 | get_headlines_all(query = NULL, category = NULL, country = NULL,
sources = NULL, api_key = Sys.getenv("NEWS_API_KEY"))
|
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 |
List with two dataframes:
1) Data frame with results_df
2) Data frame with meta_data
1 2 3 4 5 | ## Not run:
df <- get_headlines_all(query = "sports")
df <- get_headlines_all(category = "health")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.