19 releases (10 breaking)
0.11.0 | Mar 30, 2022 |
---|---|
0.10.2 | Sep 22, 2018 |
0.10.1 | Mar 12, 2018 |
0.10.0 | Dec 2, 2017 |
0.1.0 | Jun 30, 2015 |
#1840 in Web programming
90 downloads per month
Used in maman
53KB
1K
SLoC
robotparser-rs
robots.txt parser for Rust.
Installation
Add it to your Cargo.toml
:
[dependencies]
robotparser = "0.11"
Examples
use robotparser::http::RobotsTxtClient;
use robotparser::service::RobotsTxtService;
use reqwest::Client;
use url::Url;
fn main() {
let client = Client::new();
let robots_txt_url = Url::parse("https://www.python.org/robots.txt").unwrap();
let robots_txt = client.fetch_robots_txt(robots_txt_url.origin()).unwrap().get_result();
let fetch_url = Url::parse("https://www.python.org/robots.txt").unwrap();
assert!(robots_txt.can_fetch("*", &fetch_url));
}
License
This work is released under the MIT license. A copy of the license is provided in the LICENSE file.
Dependencies
~4–16MB
~211K SLoC