19 个版本 (10 个重大更改)
0.11.0 | 2022年3月30日 |
---|---|
0.10.2 | 2018年9月22日 |
0.10.1 | 2018年3月12日 |
0.10.0 | 2017年12月2日 |
0.1.0 | 2015年6月30日 |
1743 在 网页编程 中排名
每月 90 次下载
用于 maman
53KB
1K SLoC
robotparser-rs
用于 Rust 的 robots.txt 解析器。
安装
将其添加到您的 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://pythonlang.cn/robots.txt").unwrap();
let robots_txt = client.fetch_robots_txt(robots_txt_url.origin()).unwrap().get_result();
let fetch_url = Url::parse("https://pythonlang.cn/robots.txt").unwrap();
assert!(robots_txt.can_fetch("*", &fetch_url));
}
许可证
本作品采用 MIT 许可证发布。许可证副本可在 LICENSE 文件中找到。
依赖项
~3–18MB
~230K SLoC