Index: src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/BoilerpipeExtractorRepository.java
===================================================================
--- src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/BoilerpipeExtractorRepository.java	(revision 0)
+++ src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/BoilerpipeExtractorRepository.java	(revision 0)
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nutch.parse.tika;
+
+import java.lang.ClassLoader;
+import java.lang.InstantiationException;
+import java.util.WeakHashMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tika.parser.html.BoilerpipeContentHandler;
+import de.l3s.boilerpipe.BoilerpipeExtractor;
+import de.l3s.boilerpipe.extractors.*;
+
+class BoilerpipeExtractorRepository {
+
+  public static final Log LOG = LogFactory.getLog(BoilerpipeExtractorRepository.class);
+  public static final WeakHashMap<String, BoilerpipeExtractor> extractorRepository = new WeakHashMap<String, BoilerpipeExtractor>();
+ 
+  /**
+   * Returns an instance of the specified extractor
+   */
+  public static synchronized BoilerpipeExtractor getExtractor(String boilerpipeExtractorName) {
+    // Check if there's no instance of this extractor
+    if (!extractorRepository.containsKey(boilerpipeExtractorName)) {
+      // FQCN
+      boilerpipeExtractorName = "de.l3s.boilerpipe.extractors." + boilerpipeExtractorName;
+
+      // Attempt to load the class
+      try {
+        ClassLoader loader = BoilerpipeExtractor.class.getClassLoader();
+	Class extractorClass = loader.loadClass(boilerpipeExtractorName);
+
+	// Add an instance to the repository
+	extractorRepository.put(boilerpipeExtractorName, (BoilerpipeExtractor)extractorClass.newInstance());
+
+      } catch (ClassNotFoundException e) {
+        LOG.error("BoilerpipeExtractor " + boilerpipeExtractorName + " not found!");
+      } catch (InstantiationException e) {
+        LOG.error("Could not instantiate " + boilerpipeExtractorName);
+      } catch (Exception e) {
+        LOG.error(e);
+      }
+    }
+
+    return extractorRepository.get(boilerpipeExtractorName);
+  }
+}
Index: src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/TikaParser.java
===================================================================
--- src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/TikaParser.java	(revision 1448112)
+++ src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/TikaParser.java	(working copy)
@@ -54,7 +54,9 @@
 import org.apache.tika.parser.ParseContext;
 import org.apache.tika.parser.Parser;
 import org.apache.tika.parser.html.HtmlMapper;
+import org.apache.tika.parser.html.BoilerpipeContentHandler;
 import org.w3c.dom.DocumentFragment;
+import org.xml.sax.ContentHandler;
 
 /**
  * Wrapper for Tika parsers. Mimics the HTMLParser but using the XHTML
@@ -81,6 +83,9 @@
   @Override
   public Parse getParse(String url, WebPage page) {
 
+    boolean useBoilerpipe = getConf().getBoolean("tika.boilerpipe", false);
+    String boilerpipeExtractorName = getConf().get("tika.boilerpipe.extractor", "ArticleExtractor");
+
     String baseUrl = TableUtil.toString(page.getBaseUrl());
     URL base;
     try {
@@ -109,12 +114,24 @@
     HTMLDocumentImpl doc = new HTMLDocumentImpl();
     doc.setErrorChecking(false);
     DocumentFragment root = doc.createDocumentFragment();
-    DOMBuilder domhandler = new DOMBuilder(doc, root);
+    ContentHandler domHandler;
+    // Check whether to use Tika's BoilerplateContentHandler
+    if (useBoilerpipe) {
+      LOG.debug("Using Tikas's Boilerpipe with Extractor: " + boilerpipeExtractorName);
+      BoilerpipeContentHandler bpHandler = new BoilerpipeContentHandler((ContentHandler)new DOMBuilder(doc, root),
+        BoilerpipeExtractorRepository.getExtractor(boilerpipeExtractorName));
+
+      bpHandler.setIncludeMarkup(true);
+      domHandler = (ContentHandler)bpHandler;
+    } else {
+      domHandler = new DOMBuilder(doc, root);
+    }
+
     ParseContext context = new ParseContext();
     // to add once available in Tika
     // context.set(HtmlMapper.class, IdentityHtmlMapper.INSTANCE);
     try {
-      parser.parse(new ByteArrayInputStream(raw), domhandler, tikamd, context);
+      parser.parse(new ByteArrayInputStream(raw), (ContentHandler)domHandler, tikamd, context);
     } catch (Exception e) {
       LOG.error("Error parsing "+url,e);
       return ParseStatusUtils.getEmptyParse(e, getConf());
@@ -149,6 +166,20 @@
       title = sb.toString().trim();
     }
 
+    // Warning: very nasty
+    // Parse again without BP to get all outlinks
+    if (useBoilerpipe) {
+      root = doc.createDocumentFragment();
+      domHandler = new DOMBuilder(doc, root);
+      try {
+	parser.parse(new ByteArrayInputStream(raw), (ContentHandler)domHandler, tikamd, context);
+      } catch (Exception e) {
+	LOG.error("Error parsing "+url,e);
+	return ParseStatusUtils.getEmptyParse(e, getConf());
+      }
+    }
+    // END NASTY STUFF
+
     if (!metaTags.getNoFollow()) { // okay to follow links
       ArrayList<Outlink> l = new ArrayList<Outlink>(); // extract outlinks
       URL baseTag = utils.getBase(root);
Index: src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java
===================================================================
--- src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java	(revision 1448112)
+++ src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java	(working copy)
@@ -346,7 +346,9 @@
   public void endElement(String ns, String localName, String name)
           throws org.xml.sax.SAXException
   {
-    m_elemStack.pop();
+    if (!m_elemStack.isEmpty()) {
+      m_elemStack.pop();
+    }
     m_currentNode = m_elemStack.isEmpty() ? null : (Node)m_elemStack.peek();
   }
 
Index: conf/nutch-default.xml
===================================================================
--- conf/nutch-default.xml	(revision 1448112)
+++ conf/nutch-default.xml	(working copy)
@@ -808,6 +808,17 @@
   </description>
 </property>
 
+<!-- tika properties -->
+
+<property>
+  <name>tika.boilerpipe</name>
+  <value>false</value>
+</property>
+<property>
+  <name>tika.boilerpipe.extractor</name>
+  <value>ArticleExtractor</value>
+</property>
+
 <!-- mime properties -->
 
 <!--
