Apache Nutch is an extensible and scalable web crawler
Small adjustment: Keep a reference to the last outlink to set metadata.
Marcos Boribfd47dbc2ec1
diff --git a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.java b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.javaindex 32fd5fbdf..909da7ef4 100644--- a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.java+++ b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/DOMContentUtils.java@@ -436,15 +436,16 @@ public class DOMContentUtils {try {URL url = URLUtil.resolveURL(base, target);- outlinks.add(new Outlink(url.toString(), linkText.toString()- .trim()));-- // NUTCH-2433 - Keep the node name where the URL was found into+ Outlink outlink = new Outlink(url.toString(), linkText+ .toString().trim());+ outlinks.add(outlink);++ // NUTCH-2433 - Keep the node name where the URL was found into// the outlink metadataif (keepNodenames) {MapWritable metadata = new MapWritable();metadata.put(new Text(srcTagMetaName), new Text(nodeName));- outlinks.get(outlinks.size() - 1).setMetadata(metadata);+ outlink.setMetadata(metadata);}} catch (MalformedURLException e) {