Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Merge branch 'master' into NUTCH-2803

Sebastian Nagelb2ccbc93e83b
diff --cc src/java/org/apache/nutch/protocol/RobotRulesParser.java
index a836cabd5,eb3ba46f6..97256d2ba
--- a/src/java/org/apache/nutch/protocol/RobotRulesParser.java
+++ b/src/java/org/apache/nutch/protocol/RobotRulesParser.java
@@@ -131,22 -131,22 +131,21 @@@ public abstract class RobotRulesParser
agentNames = sb.toString();
}
- String[] confWhiteList = conf.getStrings("http.robot.rules.whitelist");
- if (confWhiteList == null) {
- LOG.debug("robots.txt whitelist not configured.");
- }
- else {
- for (int i = 0; i < confWhiteList.length; i++) {
- if (confWhiteList[i].isEmpty()) {
- LOG.info("Empty whitelisted URL skipped!");
+ String[] confAllowList = conf.getStrings("http.robot.rules.allowlist");
+ if (confAllowList == null) {
- LOG.info("robots.txt allowlist not configured.");
- }
- else {
++ LOG.debug("robots.txt allowlist not configured.");
++ } else {
+ for (int i = 0; i < confAllowList.length; i++) {
+ if (confAllowList[i].isEmpty()) {
+ LOG.info("Empty allowlisted URL skipped!");
continue;
}
- whiteList.add(confWhiteList[i]);
+ allowList.add(confAllowList[i]);
}
- if (whiteList.size() > 0) {
- matcher = new SuffixStringMatcher(whiteList);
- LOG.info("Whitelisted hosts: " + whiteList);
+ if (allowList.size() > 0) {
+ matcher = new SuffixStringMatcher(allowList);
+ LOG.info("Allowlisted hosts: " + allowList);
}
}
}
@@@ -159,9 -159,11 +158,11 @@@
}
/**
- * Check whether a URL belongs to a whitelisted host.
+ * Check whether a URL belongs to a allowlisted host.
+ * @param url a {@link java.net.URL} to check against rules
- * @return true if allowed, false otherwise
++ * @return true if always allowed (robots.txt rules are ignored), false otherwise
*/
- public boolean isWhiteListed(URL url) {
+ public boolean isAllowListed(URL url) {
boolean match = false;
String urlString = url.getHost();
@@@ -269,9 -273,9 +272,9 @@@
"Important properties:",
" -D fetcher.store.robotstxt=true",
"\toutput content and HTTP meta data of fetched robots.txt (if not a local file)",
- " -D http.agent.name=...\tsame as argument <agent-names>",
+ " -D http.agent.name=...\t(primary) agent name",
" -D http.robots.agents=...\tadditional agent names",
- " -D http.robot.rules.whitelist=..."};
+ " -D http.robot.rules.allowlist=..."};
for (String s : help) {
System.err.println(s);
}