1 unstable release
new 0.1.0 | Dec 18, 2024 |
---|
#5 in #news
18KB
171 lines
PTS News
PTS News is a Rust project that fetches and parses daily news from the PTS News website.
Getting Started
To use this in your project, run the following command:
cargo add pts-news
Building the Project
To build the project, run the following command:
cargo build
Running the Example
To run the example that fetches and prints the daily news, use the following command:
cargo run --example get-daily-news
Project Modules
This file contains the main module definitions and constants for the project.
pub const PTS_NEWS_URL: &str = "https://news.pts.org.tw";
pub mod daily_news;
Example
This file contains an example of how to use the get_daily_news
function to fetch and print the daily news.
use log::{info, LevelFilter};
#[tokio::main]
async fn main() {
env_logger::Builder::new()
.filter(None, LevelFilter::Info)
.init();
info!("Fetching daily news...");
let news = pts_news::daily_news::get_daily_news().await;
info!("{:#?}", news);
}
Dependencies
- log: For logging.
- reqwest: For making HTTP requests.
- scraper: For parsing HTML.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Dependencies
~6–17MB
~238K SLoC