No description
Find a file
2020-11-03 19:05:43 +08:00
.github/workflows Remove CI cache 2020-11-03 19:05:43 +08:00
src parser: replace manual strip with trim_start_matches (#29) 2020-11-03 18:26:14 +08:00
tests Inital github-actions (#25) 2020-03-30 09:32:32 +08:00
.gitignore Commit Cargo.lock to git for cache to actually work 2020-03-30 09:42:35 +08:00
Cargo.lock cargo: update (#30) 2020-11-03 18:26:28 +08:00
Cargo.toml Refactoring of robotparser-rs (#20) 2020-01-31 17:00:58 +08:00
LICENSE Initial commit 2015-06-28 01:28:41 +08:00
README.md Add support coverage via codecov + tarpaulin (#31) 2020-11-03 19:04:47 +08:00
rustfmt.toml Inital github-actions (#25) 2020-03-30 09:32:32 +08:00

robotparser-rs

GitHub Actions Coverage Status codecov Crates.io Dependency status

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.