Registry / utility / scraper

scraper

JSON →
library0.27.0rscratesunverified

HTML parsing and querying with CSS selectors.

# Cargo.toml [dependencies] scraper = "0.27.0"
INSTALL
IMPORT
SIG · SCRAPER
S
scraper
utilityrustv0.27.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Html
use scraper::Html;

Parses HTML and selects all <p> elements.

use scraper::{Html, Selector}; let html = "<html><body><p>Hello</p></body></html>"; let document = Html::parse_document(html); let selector = Selector::parse("p").unwrap(); for element in document.select(&selector) { println!("{}", element.inner_html()); }
Debug
Known issues
gotchaCSS selector parsing panics on invalid input if not handled.
fix
Use Selector::parse() with proper error handling (unwrap or match).
affects: >=0.10.0
Upgrade
Version history
0.27.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
scraper — cargo add scraper · libregistry