Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

Spire needs Rust 1.95 or later. Add it with the features you need, and tokio to run it:

[dependencies]
spire = { version = "0.6", features = ["reqwest", "macros"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Feature flags

FeatureEnables
html (default)The Html and Element extractors and the Select trait
markdownThe Markdown extractor, a page’s main content as Markdown
macros#[derive(Select)] and #[derive(Tags)]
reqwestReqwestBackend, the HTTP backend
thirtyfourThirtyfourBackend, the WebDriver backend
user-agentsBrowser user agents with matching navigation headers for identities
robotsObeying robots.txt with Crawler::with_robots
sitemapThe Sitemap extractor and the FollowSitemap handler
serdeSerializable seeds for snapshots
jsonJsonlDataset
csvCsvDataset
redbRedbStore, a crash-safe frontier, seen set and datasets on disk
rustls-tls (default), native-tlsTLS for the enabled backends
testingMockSite and Visit, to test handlers without a network
fullEverything except native-tls and testing

Enable testing in your dev-dependencies only; see Testing.

The HTTP backend’s own features

spire-reqwest has features of its own for compression, cookies and more. Depend on it next to spire to turn them on:

[dependencies]
spire-reqwest = { version = "0.6", features = ["gzip", "brotli", "cookies"] }
FeatureEnables
http2 (default)HTTP/2 negotiation
system-proxy (default)Proxies from the environment and system settings
gzip, brotli, zstd, deflateTransparent response decompression
cookiesA cookie store shared by the whole crawl
socksSOCKS5 proxies
hickory-dnsDNS through hickory instead of the system resolver