get_everything
searches through articles from large and small news
sources and blogs. This includes breaking news as well as other regular articles.
You can search for multiple sources
, different language
,
or use your own keywords. Articles can be sorted by the earliest date
publishedAt
, relevancy
, or popularity
. To automatically
download all results, use get_everything_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 languages for language
are provided in the dataset
terms_language
. To automatically download all results for one search,
use get_everything_all
.
Please check that the api_key
is available. You can provide an explicit
definition of the api_key or use set_api_key
For valid searchterms see data(searchterms)
get_everything_all(query, sources = NULL, domains = NULL,
exclude_domains = NULL, from = NULL, to = NULL, language = NULL,
sort_by = "publishedAt", api_key = Sys.getenv("NEWS_API_KEY"))
Character string that contains the searchterm for the API's data base. API supports advanced search parameters, see 'details'.
Character string with IDs (comma separated) of the news outlets you want to focus on (e.g., "usa-today, spiegel-online").
Character string (comma separated) with domains that you want to restrict your search to (e.g., "bbc.com, nytimes.com").
Similar usage as with 'domains'. Will exclude these domains from your search.
Marks the start date of your search. Must be in ISO 8601 format (e.g., "2018-09-08" or "2018-09-08T12:51:42"). Default is the oldest available date (depends on your paid/unpaid plan from newsapi.org).
Marks the end date of your search. Works similarly to 'from'. Default is the latest article available.
Specifies the language of the articles of your search. Must be in ISO shortcut format (e.g., "de", "en"). See list of all languages on https://newsapi.org/docs/endpoints/everything. Default is all languages.
Character string that specifies the sorting of your article results. Accepts three options: "publishedAt", "relevancy", "popularity". Default is "publishedAt".
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 set_api_key
).
List with two dataframes:
1) Data frame with results_df
2) Data frame with meta_data
# NOT RUN {
df <- get_everything_all(query = "mannheim")
df <- get_everything_all(query = "stuttgart", language = "en")
# }
Run the code above in your browser using DataLab