@@ -12,6 +12,7 @@ Ensures your bot plays by the rules defined by website owners, preventing unauth
1212## Features
1313
1414- ** 🚀 Automated Compliance** : Validates every request against ` robots.txt ` rules (cached per origin).
15+ - ** ⏱️ Crawl-Delay** : Option to automatically wait before requests if ` Crawl-delay ` is specified.
1516- ** 🛡️ Strict Mode** : invalid URLs, non-HTTP/S protocols, or unreachable ` robots.txt ` files (non-4xx error) block requests by default.
1617- ** ✨ Clean Architecture** : built with maintainability and separation of concerns in mind.
1718- ** 🔌 Plug-and-Play** : easily attaches to any Axios instance.
@@ -43,7 +44,7 @@ const client = axios.create();
4344
4445// Apply the interceptor
4546applyRobotsInterceptor (client , {
46- userAgent: ' MyCoolBot/1.0'
47+ userAgent: ' MyCoolBot/1.0' ,
4748});
4849
4950async function crawl() {
@@ -81,6 +82,13 @@ Attaches the interceptor to the provided Axios instance.
8182``` typescript
8283interface RobotsPluginOptions {
8384 userAgent: string ;
85+ crawlDelayCompliance? : CrawlDelayComplianceMode ; // default: CrawlDelayComplianceMode.Await
86+ }
87+
88+ enum CrawlDelayComplianceMode {
89+ Await = ' await' , // Respects delay by waiting
90+ Ignore = ' ignore' , // Ignores delay
91+ Failure = ' failure' // Throws Error if delay is not met
8492}
8593```
8694
@@ -111,9 +119,9 @@ The interceptor throws a `RobotsError` in the following cases:
111119- [x] ** [ RFC 9309] ( https://www.rfc-editor.org/rfc/rfc9309.html ) Compliance** : Full support for the standard Robots Exclusion Protocol.
112120- [x] ** Standard Directives** : Supports ` User-agent ` , ` Allow ` , and ` Disallow ` .
113121- [x] ** Wildcards** : Supports standard path matching including ` * ` and ` $ ` .
122+ - [x] ** Crawl-delay** : The interceptor enforces ` Crawl-delay ` directives (automatic throttling) if configured.
114123
115124### 🚧 Missing / TODO
116- - [ ] ** Crawl-delay** : The interceptor currently does ** not** enforce ` Crawl-delay ` directives (automatic throttling).
117125- [ ] ** Sitemap** : Does not currently expose or parse ` Sitemap ` directives for the consumer.
118126- [ ] ** Cache TTL** : Caching is currently indefinite for the lifecycle of the Axios instance.
119127
0 commit comments