Crates.io | newsapi |
lib.rs | newsapi |
version | 0.6.0 |
source | src |
created_at | 2019-04-25 12:02:38.654485 |
updated_at | 2022-07-01 12:34:44.410057 |
description | Wrapper for the newsapi, uses reqwest to do the http work. A learn by doing project |
homepage | https://github.com/biomunky/newsapi |
repository | |
max_upload_size | |
id | 130121 |
size | 69,151 |
The News API allows you to get breaking news headlines, and search for articles from over 30,000 news sources and blogs.
Version 0.5.x renames the Client
struct to NewsAPIClient
. See examples for demonstrated usage.
Version 0.4.x introduces async fetch. While synchronous functionality is retained, the relevant functions have been renamed. Please check examples for further details. The core change is send
has been replaced with send_async
and send_sync
for the asynchronous and synchronous variants respectively.
All you need is an API key to
The following limits apply
See here for pricing
There are three endpoints
Top Headlines and Everything endpoints are wrapped by an Article struct and Sources by a Source struct. Both currently provide limited functionality.
As described in The Cargo Book the project has some simple examples in examples/. These can be run via cargo after you've exported your NEWSAPI_KEY
export NEWSAPI_KEY=5h79off128957edb3179y5da1nb36y9e
To list all examples:
cargo run --example
to run a specific example
cargo run --example get_sources_async
Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
We have no affiliation with the News API team.