Package org.apache.nutch.parse.js
Class JSParseFilter
java.lang.Object
org.apache.nutch.parse.js.JSParseFilter
- All Implemented Interfaces:
Configurable,HtmlParseFilter,Parser,Pluggable
This class is a heuristic link extractor for JavaScript files and code
snippets. The general idea of a two-pass regex matching comes from Heritrix.
Parts of the code come from OutlinkExtractor.java
-
Field Summary
Fields inherited from interface org.apache.nutch.parse.HtmlParseFilter
X_POINT_IDFields inherited from interface org.apache.nutch.parse.Parser
X_POINT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfilter(Content content, ParseResult parseResult, HTMLMetaTags metaTags, DocumentFragment doc) Scan the JavaScript fragments of a HTML page looking for possibleOutlink'sgetConf()Parse a JavaScript file and extract outlinksstatic voidMain method which can be run from command line with the plugin option.voidsetConf(Configuration conf)
-
Constructor Details
-
JSParseFilter
public JSParseFilter()
-
-
Method Details
-
filter
public ParseResult filter(Content content, ParseResult parseResult, HTMLMetaTags metaTags, DocumentFragment doc) Scan the JavaScript fragments of a HTML page looking for possibleOutlink's- Specified by:
filterin interfaceHtmlParseFilter- Parameters:
content- page contentparseResult- parsed content, result of running the HTML parsermetaTags- within theHTMLMetaTagsdoc- TheDocumentFragmentobject- Returns:
- parse the actual
ParseResultobject with additional outlinks from JavaScript - See Also:
-
getParse
Parse a JavaScript file and extract outlinks -
main
Main method which can be run from command line with the plugin option. The method takes two arguments e.g. o.a.n.parse.js.JSParseFilter file.js baseURL- Parameters:
args- run with no args to get help- Throws:
Exception- if there is a fatal error running the class with the given input
-
setConf
- Specified by:
setConfin interfaceConfigurable
-
getConf
- Specified by:
getConfin interfaceConfigurable
-