Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何在 java 中解析 robots.txt。
是否已经有任何代码?
Heritrix是一个用 Java 编写的开源网络爬虫。查看他们的 javadoc,我看到他们有一个实用程序类Robotstxt用于解析 robots.txt 文件。
SourceForge还托管了jrobotx 库。
(完全披露:我剥离了构成该库的代码。)
还有一个新版本的 crawler-commons:
https://github.com/crawler-commons/crawler-commons
该库旨在实现任何网络爬虫通用的功能,其中包括一个非常方便的 robots.txt 解析器