pts-news

Crates.iopts-news
lib.rspts-news
version0.1.0
created_at2024-12-18 08:49:13.34501+00
updated_at2024-12-18 08:49:13.34501+00
descriptionTools to fetch and parse daily news from the PTS News website
homepagehttps://github.com/x807x/pts-news
repositoryhttps://github.com/x807x/pts-news
max_upload_size
id1487319
size64,778
807 (x807x)

documentation

README

PTS News

Rust

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.

Commit count: 7

cargo fmt