Expand description
§spider-middleware
Built-in middleware for the crawler runtime.
This crate contains the request/response hooks that sit between scheduling,
downloading, and parsing. It is the right layer for retry policy, rate
limiting, cookies, proxies, user agents, robots.txt, and caching.
§Example
ⓘ
use spider_middleware::{rate_limit::RateLimitMiddleware, retry::RetryMiddleware};
let crawler = CrawlerBuilder::new(MySpider)
.add_middleware(RateLimitMiddleware::default())
.add_middleware(RetryMiddleware::new())
.build()
.await?;Modules§
- middleware
- Middleware trait and control-flow types.
- prelude
- Common
spider-middlewarere-exports. - rate_
limit - Rate-limiting middleware.
- referer
- Middleware that fills
Refererheaders for follow-up requests. - retry
- Retry middleware.
Structs§
- Request
- Outgoing HTTP request used by the crawler runtime.
- Response
- Represents an HTTP response received from a server.
Enums§
- Body
- Request body variants supported by the default downloader.