get_everything_all: Returns all articles from newsapi.org in one data frame

Description Usage Arguments Value Examples

Description

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)

Usage

1
2
3
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"))

Arguments

query

Character string that contains the searchterm for the API's data base. API supports advanced search parameters, see 'details'.

sources

Character string with IDs (comma separated) of the news outlets you want to focus on (e.g., "usa-today, spiegel-online").

domains

Character string (comma separated) with domains that you want to restrict your search to (e.g., "bbc.com, nytimes.com").

exclude_domains

Similar usage as with 'domains'. Will exclude these domains from your search.

from

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).

to

Marks the end date of your search. Works similarly to 'from'. Default is the latest article available.

language

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.

sort_by

Character string that specifies the sorting of your article results. Accepts three options: "publishedAt", "relevancy", "popularity". Default is "publishedAt".

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 set_api_key).

Value

List with two dataframes:
1) Data frame with results_df
2) Data frame with meta_data

Examples

1
2
3
4
5
## Not run: 
df <- get_everything_all(query = "mannheim")
df <- get_everything_all(query = "stuttgart", language = "en")

## End(Not run)

newsanchor documentation built on June 29, 2019, 5:02 p.m.