Skip to main content

Crate chadselect

Crate chadselect 

Source
Expand description

§ChadSelect

Unified data extraction — Regex, XPath 1.0, CSS Selectors, and JMESPath behind one query interface.

use chadselect::ChadSelect;

let mut cs = ChadSelect::new();
cs.add_html(r#"<span class="price">$49.99</span>"#.to_string());

let price = cs.select(0, "css:.price");
assert_eq!(price, "$49.99");

§Query prefixes

PrefixEngineContent types
regex:RegexAll
xpath:XPath 1.0HTML, Text
css:CSSHTML
json:JMESPathJSON

If no prefix is provided, the query defaults to Regex.

§Post-processing functions

Pipe results through text functions using >>:

css:.price >> normalize-space() >> uppercase()
xpath://div/text() >> substring-after('VIN: ')

Re-exports§

pub use content::ContentItem;
pub use content::ContentType;
pub use functions::supported_text_functions;
pub use query::QueryType;
pub use query::FUNCTION_PIPE;

Modules§

content
Content types and content item storage with lazy-parsed caching.
engine
Extraction engine modules.
functions
Post-processing text functions — shared by CSS and XPath engines.
query
Query type parsing — prefix-based routing to the correct extraction engine.

Structs§

ChadSelect
Main entry point for data extraction.