org.apache.nutch.parse.js

## Class JSParseFilter

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

- All Implemented Interfaces:
    Configurable, ParseFilter, Parser, FieldPluggable, Pluggable

      public class JSParseFilter
      extends java.lang.Object
      implements ParseFilter, 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 by Stephan Strittmatter.
  Author:
    Andrzej Bialecki <ab@getopt.org>

- - ### Field Summary

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

      `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
    --- | ---
    `Parse` | `filter(java.lang.String url, WebPage page, Parse parse, HTMLMetaTags metaTags, org.w3c.dom.DocumentFragment doc)` Scan the JavaScript looking for possible `Outlink`'s
    `Configuration` | `getConf()` Get the `Configuration` object
    `java.util.Collection<WebPage.Field>` | `getFields()` Gets all the fields for a given `WebPage` Many datastores need to setup the mapreduce job by specifying the fields needed.
    `Parse` | `getParse(java.lang.String url, WebPage page)` Parse a JavaScript file and extract outlinks
    `static void` | `main(java.lang.String[] args)` Main method which can be run from command line with the plugin option.
    `void` | `setConf(Configuration conf)` Set the `Configuration` object

    - ### 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 Parse filter(java.lang.String url,
                              WebPage page,
                              Parse parse,
                              HTMLMetaTags metaTags,
                              org.w3c.dom.DocumentFragment doc)

      Scan the JavaScript looking for possible `Outlink`'s
      Specified by:
        `filter` in interface `ParseFilter`
      Parameters:
        `url` - URL of the `WebPage` to be parsed
        `page` - `WebPage` object relative to the URL
        `parse` - `Parse` object holding parse status
        `metaTags` - within the `HTMLMetaTags`
        `doc` - The `DocumentFragment` object
      Returns:
        parse the actual `Parse` object with additional outlinks from JavaScript

    - #### getParse

          public Parse getParse(java.lang.String url,
                                WebPage page)

      Parse a JavaScript file and extract outlinks
      Specified by:
        `getParse` in interface `Parser`
      Parameters:
        `url` - URL of the `WebPage` which is parsed
        `page` - `WebPage` object relative to the URL
      Returns:
        parse the actual `Parse` object

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.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:
        `java.lang.Exception`

    - #### setConf

          public void setConf(Configuration conf)

      Set the `Configuration` object
      Specified by:
        `setConf` in interface `Configurable`

    - #### getConf

          public Configuration getConf()

      Get the `Configuration` object
      Specified by:
        `getConf` in interface `Configurable`

    - #### getFields

          public java.util.Collection<WebPage.Field> getFields()

      Gets all the fields for a given `WebPage` Many datastores need to setup the mapreduce job by specifying the fields needed. All extensions that work on WebPage are able to specify what fields they need.
      Specified by:
        `getFields` in interface `FieldPluggable`

Copyright © 2019 The Apache Software Foundation