get_sources: Returns selected sources from newsapi.org

Description Usage Arguments Value Examples

Description

get_sources returns the news sources currently available on newsapi.org. The sources can be filtered using category, language or country. If the arguments are empty the query return all available sources.

Usage

1
2
get_sources(category = NULL, language = NULL, country = NULL,
  api_key = Sys.getenv("NEWS_API_KEY"))

Arguments

category

Category you want to get sources for as a string. Default: NULL.

language

The langauge you want to get sources for as a string. Default: NULL.

country

The country you want to get sources for as a string (e.g. "us"). Default: NULL.

api_key

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
6
## Not run: 
get_sources(api_key)
get_sources(api_key, category = "technology")
get_sources(api_key, language = "en")

## End(Not run)

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