All Projects → messense → robotparser-rs

messense / robotparser-rs

Licence: MIT license
robots.txt parser for Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to robotparser-rs

robots-parser
NodeJS robots.txt parser with support for wildcard (*) matching.
Stars: ✭ 117 (+631.25%)
Mutual labels:  robots-parser
robots.txt
🤖 robots.txt as a service. Crawls robots.txt files, downloads and parses them to check rules through an API
Stars: ✭ 13 (-18.75%)
Mutual labels:  robots-parser
protego
A pure-Python robots.txt parser with support for modern conventions.
Stars: ✭ 36 (+125%)
Mutual labels:  robots-parser

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].