429 stable releases

new 2.27.23 Jan 29, 2025
2.23.3 Dec 31, 2024
2.13.84 Nov 30, 2024
0.2.3 Aug 20, 2024
0.1.3 Jul 24, 2024

#2142 in Web programming

Download history 4016/week @ 2024-10-09 2429/week @ 2024-10-16 3300/week @ 2024-10-23 3294/week @ 2024-10-30 1924/week @ 2024-11-06 392/week @ 2024-11-13 5196/week @ 2024-11-20 5228/week @ 2024-11-27 3657/week @ 2024-12-04 3265/week @ 2024-12-11 767/week @ 2024-12-18 1610/week @ 2024-12-25 1785/week @ 2025-01-01 1837/week @ 2025-01-08 482/week @ 2025-01-15 5181/week @ 2025-01-22

9,750 downloads per month

MIT license

715KB
15K SLoC

spider_utils

Utilities to use to help with getting the most out of spider.

CSS Scraping

use spider::{
    hashbrown::HashMap,
    packages::scraper::Selector,
};
use spider_utils::{QueryCSSMap, QueryCSSSelectSet, build_selectors, css_query_select_map_streamed};

async fn css_query_selector_extract() {
    let map = QueryCSSMap::from([(
        "list",
        QueryCSSSelectSet::from([".list", ".sub-list"]),
    )]);
    let data = css_query_select_map_streamed(
        r#"<html>
            <body>
                <ul class="list"><li>First</li></ul>
                <ul class="sub-list"><li>Second</li></ul>
            </body>
        </html>"#,
        &build_selectors(map),
    )
    .await;

    println!("{:?}", data);
    // {"list": ["First", "Second"]}
}

Features

You can use the feature flag indexset to order the CSS scraping extraction order.

Dependencies

~19–34MB
~599K SLoC