1.0.2 • Published 4 years ago

dom-readability v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Readability

There are two options to parse a document

you must create a new Readability object from a DOM document object, and then call parse(). Here's an example:

const JSDom = require("jsdom").JSDOM;
const { Readability } = require("dom-readability");

var document = new JSDom(html).window.document;
var article = new Readability(document).parse();

This article object will contain the following properties:

  • title: article title
  • content: HTML string of processed article content
  • length: length of an article, in characters
  • excerpt: article description, or short excerpt from the content
  • byline: author metadata
  • dir: content direction

if you don't want to parse the DOM you can use the following method

const { Parse } = require("dom-readability");

var article = Parse(html);