Robots.io 是一个 Java 库,旨在简化网站“robots.txt”文件的解析。
如何使用
类提供了使用 robots.io 的所有功能。
例子
连接
要使用 User-Agent 字符串“test”解析 Google 的 robots.txt:
RobotsParser robotsParser = new RobotsParser ( " test " );
robotsParser . connect( " http://google.com " );
或者,要在没有 User-Agent 的情况下进行解析,只需将构造函数留空即可。
您还可以传递带有路径的域。
robotsParser . connect( " http://google.com/example.htm " ); // This would also be valid
注意:域可以以字符串形
2021-06-29 19:22:45
21KB
Java
1