org.apache.nutch.parse.js

## Class JSParseFilter

- java.lang.Object
- - org.apache.nutch.parse.js.JSParseFilter

- All Implemented Interfaces:
    Configurable, HtmlParseFilter, Parser, Pluggable

      public class JSParseFilter
      extends Object
      implements HtmlParseFilter, Parser

  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_ID`

    - ### Fields inherited from interface org.apache.nutch.parse.Parser

      `X_POINT_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSParseFilter()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ParseResult` | `filter(Content content, ParseResult parseResult, HTMLMetaTags metaTags, DocumentFragment doc)` Scan the JavaScript fragments of a HTML page looking for possible `Outlink`'s
    `Configuration` | `getConf()`
    `ParseResult` | `getParse(Content c)` Parse a JavaScript file and extract outlinks
    `static void` | `main(String[] args)` Main method which can be run from command line with the plugin option.
    `void` | `setConf(Configuration conf)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JSParseFilter

          public JSParseFilter()

  - ### Method Detail

    - #### filter

          public ParseResult filter(Content content,
                                    ParseResult parseResult,
                                    HTMLMetaTags metaTags,
                                    DocumentFragment doc)

      Scan the JavaScript fragments of a HTML page looking for possible `Outlink`'s
      Specified by:
        `filter` in interface `HtmlParseFilter`
      Parameters:
        `content` - page content
        `parseResult` - parsed content, result of running the HTML parser
        `metaTags` - within the `HTMLMetaTags`
        `doc` - The `DocumentFragment` object
      Returns:
        parse the actual `ParseResult` object with additional outlinks from JavaScript

    - #### getParse

          public ParseResult getParse(Content c)

      Parse a JavaScript file and extract outlinks
      Specified by:
        `getParse` in interface `Parser`
      Parameters:
        `c` - page content
      Returns:
        parse the actual `Parse` object

    - #### main

          public static void main(String[] args)
                           throws Exception

      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` -
      Throws:
        `Exception`

    - #### setConf

          public void setConf(Configuration conf)

      Specified by:
        `setConf` in interface `Configurable`

    - #### getConf

          public Configuration getConf()

      Specified by:
        `getConf` in interface `Configurable`

Copyright © 2021 The Apache Software Foundation