9 releases

0.1.8 Dec 28, 2020
0.1.7 Jul 12, 2020
0.1.6 Mar 11, 2020
0.1.4 Feb 27, 2020

#404 in Web programming

Download history 11/week @ 2021-06-25 27/week @ 2021-07-02 19/week @ 2021-07-09 37/week @ 2021-07-16 20/week @ 2021-07-23 41/week @ 2021-07-30 19/week @ 2021-08-06 41/week @ 2021-08-13 25/week @ 2021-08-20 35/week @ 2021-08-27 9/week @ 2021-09-03 54/week @ 2021-09-10 45/week @ 2021-09-17 9/week @ 2021-09-24 6/week @ 2021-10-01 23/week @ 2021-10-08

110 downloads per month
Used in crabler

MIT license

27KB
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

~2MB
~39K SLoC