Crates.io | robotparser |
lib.rs | robotparser |
version | 0.11.0 |
source | src |
created_at | 2015-06-30 16:19:50.081581 |
updated_at | 2022-03-30 02:24:40.611163 |
description | robots.txt parser for Rust |
homepage | https://github.com/messense/robotparser-rs |
repository | https://github.com/messense/robotparser-rs |
max_upload_size | |
id | 2506 |
size | 74,470 |
robots.txt parser for Rust.
Add it to your Cargo.toml
:
[dependencies]
robotparser = "0.11"
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));
}
This work is released under the MIT license. A copy of the license is provided in the LICENSE file.