Crates.io | gnews-rs |
lib.rs | gnews-rs |
version | 1.1.3 |
source | src |
created_at | 2024-01-12 23:23:24.065045 |
updated_at | 2024-01-14 17:27:03.979626 |
description | A simple Google News RSS feed parser |
homepage | |
repository | https://github.com/pgxtips/gnews-rs |
max_upload_size | |
id | 1098136 |
size | 61,846 |
gnews-rs is a Rust crate that provides a simple interface to retrieve the latest news feed from Google News. It leverages the power of Rust to offer a fast and efficient way to access news articles programmatically.
cargo add gnews-rs
[dependencies]
gnews-rs = "1.1.3"
use gnews_rs::NewsClient;
#[tokio::main]
async fn main() {
let top_stories = NewsClient::get_top_stories().await;
let topic_world = NewsClient::get_topic(NewsClient::Topic::World).await;
let topic_health = NewsClient::get_topic(NewsClient::Topic::Health).await;
let topic_sports = NewsClient::get_topic(NewsClient::Topic::Sports).await;
let topic_science = NewsClient::get_topic(NewsClient::Topic::Science).await;
let topic_technology = NewsClient::get_topic(NewsClient::Topic::Technology).await;
let topic_business = NewsClient::get_topic(NewsClient::Topic::Business).await;
let topic_entertainment = NewsClient::get_topic(NewsClient::Topic::Entertainment).await;
let search_news = NewsClient::get_search("rust programming").await;
for story in search_news{
println!("Title: {}", story.title);
println!("Google News link: {}", story.rss_link);
println!("True Origin link: {}", story.origin_link);
println!("Thumbnail link: {}", story.thumbnail_link);
println!("Description: {}", story.description);
println!("Published: {}", story.pub_date);
println!("guid: {}", story.guid);
println!("comments: {}", story.comments);
println!("==============================");
}
}
Thank you for considering contributing to gnews-rs! Contributions are essential for improving the project and making it more valuable for the community. Feel free to fork/make pull request on the repo, your contributions are most welcome!
The source code for the site is licensed under the MIT license, which you can find in
the LICENSE
file.