8 releases (4 breaking)
Uses old Rust 2015
0.5.1 | Mar 25, 2021 |
---|---|
0.5.0 | Feb 14, 2020 |
0.4.1 | Apr 29, 2019 |
0.3.0 | Nov 14, 2018 |
0.1.1 | Nov 2, 2018 |
#1594 in Web programming
2,376 downloads per month
Used in 21 crates
(18 directly)
50KB
863 lines
Soup
Inspired by the python library BeautifulSoup, this is a layer on top of html5ever that adds a different API for querying & manipulating HTML
Documentation (latest release)
Installation
In order to use, add the following to your Cargo.toml
:
[dependencies]
soup = "0.5"
Usage
// src/main.rs
extern crate reqwest;
extern crate soup;
use std::error::Error;
use reqwest;
use soup::prelude::*;
fn main() -> Result<(), Box<Error>> {
let response = reqwest::get("https://google.com")?;
let soup = Soup::from_reader(response);
let some_text = soup.tag("p")
.attr("class", "hidden")
.find()
.and_then(|p| p.text());
OK(())
}
Dependencies
~3–5MB
~93K SLoC