#html #tags #error #id #ul

soup

Inspired by the python library BeautifulSoup, this is a layer on top of html5ever that adds a different API for querying and manipulating HTML

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

Download history 1536/week @ 2024-12-10 1577/week @ 2024-12-17 493/week @ 2024-12-24 566/week @ 2024-12-31 1730/week @ 2025-01-07 1410/week @ 2025-01-14 1399/week @ 2025-01-21 1286/week @ 2025-01-28 1627/week @ 2025-02-04 1181/week @ 2025-02-11 654/week @ 2025-02-18 719/week @ 2025-02-25 439/week @ 2025-03-04 699/week @ 2025-03-11 626/week @ 2025-03-18 509/week @ 2025-03-25

2,376 downloads per month
Used in 21 crates (18 directly)

CC-PDDC license

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)

Documentation (master)

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