6 releases (breaking)
0.6.0 | Jul 1, 2022 |
---|---|
0.4.0 | Nov 12, 2020 |
0.3.1 | Feb 21, 2020 |
0.3.0 | Dec 28, 2019 |
0.1.0 | Apr 25, 2019 |
#1726 in Web programming
50 downloads per month
29KB
658 lines
The News API Rust Library
The News API allows you to get breaking news headlines, and search for articles from over 30,000 news sources and blogs.
Breaking changes**
-
Version 0.5.x renames the
Client
struct toNewsAPIClient
. 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 withsend_async
andsend_sync
for the asynchronous and synchronous variants respectively.
Summary
All you need is an API key to
- Search live top headlines or search all articles
- New articles available with 15 minute delay
- And Search articles up to a month old
- Get short article snippet or descriptions
The following limits apply
- 1,000 requests per day
- No extra requests available
- No uptime SLA
- Basic support
- NewsAPI.org attribution required
See here for pricing
Notes
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.
Examples
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
License
Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
Disclaimer
We have no affiliation with the News API team.
Dependencies
~7–22MB
~283K SLoC