10 releases

0.1.9 Mar 12, 2021
0.1.8 Jun 1, 2020
0.1.7 Apr 18, 2020

#58 in Web programming

Download history 616/week @ 2021-07-07 1043/week @ 2021-07-14 847/week @ 2021-07-21 1228/week @ 2021-07-28 1134/week @ 2021-08-04 1014/week @ 2021-08-11 1096/week @ 2021-08-18 1097/week @ 2021-08-25 710/week @ 2021-09-01 942/week @ 2021-09-08 1277/week @ 2021-09-15 933/week @ 2021-09-22 795/week @ 2021-09-29 999/week @ 2021-10-06 777/week @ 2021-10-13 584/week @ 2021-10-20

3,901 downloads per month
Used in 7 crates (6 directly)

MIT/Apache

225KB
2K SLoC

Nipper

A crate for manipulating HTML with Rust.

Nipper based on HTML crate html5ever and the CSS selector crate selectors. You can use the jQuery-like syntax to query and manipulate an HTML document quickly. Not only can query, but also can modify.

nipper-logo

Example

Extract the hacker news.

use nipper::Document;

fn main() {
    let html = include_str!("../test-pages/hacker_news.html");
    let document = Document::from(html);

    document.select("tr.athing").iter().for_each(|athing| {
        let title = athing.select(".title a");
        let href = athing.select(".storylink");
        println!("{}", title.text());
        println!("{}", href.attr("href").unwrap());
        println!();
    });
}

Readability.

examples/readability.rs

Related projects

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~3.5MB
~72K SLoC