de_hypertext 0.1.4

serde_json ergonomics for parsing html
Documentation
use de_hypertext::Deserializer;
use std::error::Error;

#[allow(unused)]
#[derive(Debug, de_hypertext_macro::Deserialize)]
struct BooksPage {
    #[de_hypertext(selector = "title", trim)]
    title: String,
    #[de_hypertext(selector = ".pager > .current", trim)]
    pages: String,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let html = reqwest::get("https://books.toscrape.com/")
        .await?
        .text()
        .await?;
    let result = BooksPage::from_html(&html)?;
    println!("{result:#?}");
    Ok(())
}