Socket
Socket
Sign inDemoInstall

node-readability-kashif

Package Overview
Dependencies
120
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-readability-kashif

Turning any web page into a clean view.


Version published
Weekly downloads
2
decreased by-85.71%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Readability

Turn any web page into a clean view. This module is based on arc90's readability project.

Features

  1. Optimized for more websites.
  2. Supporting HTML5 tags(article, section) and Microdata API.
  3. Focusing on both accuracy and performance. 4x times faster than arc90's version.
  4. Supporting encodings such as GBK and GB2312.

Install

$ npm install node-readability-kashif

Usage

read(html [, options], callback)

Where

  • html url or html code.
  • callback is the callback to run - callback(error, article, meta)

Example

var read = require('node-readability');

read('http://howtonode.org/really-simple-file-uploads', function(err, article, meta) {
  // Main Article
  console.log(article.content);
  
  // Title
  console.log(article.title);
  
  //uri
  console.log(article.uri);
  
  //lead_image_url
  console.log(article.lead_image_url);
  
  //excerpt
  console.log(article.excerpt);
  
  //redirection -- boolean tells redirection is happening or not
  console.log(article.redirection);
  
  //Author
  console.log(article.byline);
  
  // Response Object from Request Lib
  console.log(meta);
});
read('http://howtonode.org/really-simple-file-uploads', function(err, article, meta) {
  if(err){
    console.log(err);
    if(err.status >= 400 && err.status < 511){
      console.log("Page not found");
    }
  }
});

NB If the page has been marked with charset other than utf-8, it will be converted automatically. Charsets such as GBK, GB2312 is also supported.

article object

content

The article content of the web page. Return false if failed.

title

The article title of the web page. It's may not same to the text in the <title> tag.

uri

The article uri of the web page.

lead_image_url

The article main image of web page. Pick from meta tag og:image.

excerpt

The article expert of web page.

redirection

boolean tells redirection is happening or not.

Author

The article author of web page.

meta object

response object from request lib. If you need to get current url after all redirect or get some headers it can be useful.

Keywords

FAQs

Last updated on 05 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc