Newsie is a library for accessing APIs that provide news articles.
Newsie is available on hex.pm.
You can either add it as a dependency in your mix.exs
.
To add it to a mix project, just add a line like this in your deps function in mix.exs:
defp deps do
[
{:newsie, "~> 0.1.0"}
]
end
Support for the following providers is built into Newsie:
News APIs require authentication, usually with a simple API key/token.
Check the documentation for each provider and the configuration provider Newsie.Config
.
Configuration can be set with Elixir application config or with environment variables.
For example if you're configuring the NewsApi provider which requires an api_key
.
config :newsie, Newsie.Providers.NewsApi, api_key: "my_api_key"
The format of the environment variable is NEWSIE_
followed by the provider name and parameter name snake-cased. NEWSIE_<provider>_<param>
.
NEWSIE_NEWS_API_API_KEY=my_api_key
Since each provider has different capabilities and ways of fetching news, there's currently no unified or standard interface to querying in a provider-agnostic way. Check the documentation for each provider to see how to use them.
Newsie.Providers.CurrentsApi
Newsie.Providers.NewsApi
Newsie.Providers.Newsriver