Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including html-readability with all npm packages installed. Try it out:

var htmlReadability = require("html-readability")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

html-readability v0.1.4

node readability

##html-readability

node.js html readability parser

NPM

###Get started

var readability = require("readability");
var html = "<html>xxxxxxxxxxx</html>";
readability.parse(html, function(err, article){
    /* article
        article = {
            title: "", // page title 
            text: "", //text content
            html: "", //pretty html content
            time: {
               title: 10, //parse title elapsed milliseconds
               article: 100 //parse content elapsed milliseconds
            }
        }
    */
});

###Usage

1. pass an object:

var options = {
    url: "http://example.com/article/some-article.html", // url is optional, if supply, can convert relative url to absolute.
    content: "<html>some html</html>"
};

readability.parse(options, function(err, article){
    //some code
});

2. pass a html string:

var html = "<html>some html</html>";

readability.parse(html, function(err, article){
    //some code
});

3. pass an url:

var url = "http://example.com/article/some-article.html";

readability.parse(url, function(err, article){
    //some code
});

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free