10 releases

0.1.9 Apr 1, 2022
0.1.8 Dec 28, 2020
0.1.7 Jul 12, 2020
0.1.6 Mar 11, 2020
0.1.4 Feb 27, 2020

#2187 in Web programming

Download history 94/week @ 2024-06-17 59/week @ 2024-06-24 59/week @ 2024-07-01 38/week @ 2024-07-08 48/week @ 2024-07-15 157/week @ 2024-07-22 108/week @ 2024-07-29 87/week @ 2024-08-05 93/week @ 2024-08-12 67/week @ 2024-08-19 65/week @ 2024-08-26 49/week @ 2024-09-02 289/week @ 2024-09-09 44/week @ 2024-09-16 326/week @ 2024-09-23 175/week @ 2024-09-30

843 downloads per month
Used in 3 crates

MIT license

28KB
789 lines

CrabQuery - like JQuery, but for Crabs

CI Crates.io docs.rs MIT licensed

Small and simple library to query HTML markup for your web scraping needs.

Based on servo libraries. Supports more complicated CSS selectors than other similar libraries.

Examples

use crabquery::Document;

let doc = Document::from(
    "<div class='container'>
       <a class='link button' id='linkmain'>
         <span>text hi there</span>
       </a>
     </div>",
);

let sel = doc.select("div.container > a.button.link[id=\"linkmain\"]");
let el = sel.first().unwrap();

assert_eq!(el.attr("id").unwrap(), "linkmain");

let sel = doc.select("div > a > span");
let el = sel.first().unwrap();

assert_eq!(el.text().unwrap(), "text hi there");

Dependencies

~1.5–6MB
~36K SLoC