Socket
Socket
Sign inDemoInstall

node-readability

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-readability - npm Package Compare versions

Comparing version 0.0.3 to 0.0.5

6

package.json
{
"name": "node-readability",
"version": "0.0.3",
"version": "0.0.5",
"author": "Zihua Li",
"description": "Turn any web page into a clean view",
"description": "Turning any web page into a clean view.",
"homepage": "https://github.com/luin/node-readability",

@@ -26,2 +26,2 @@ "repository": {

]
}
}

@@ -25,6 +25,6 @@ # node-readability

var readability = require('./readability');
var readability = require('node-readability');
readability.read('http://howtonode.org/really-simple-file-uploads', function(err, article) {
console.log(article.getArticleContent());
console.log(article.getContent());
});

@@ -31,0 +31,0 @@

@@ -524,3 +524,3 @@ // All of the regular expressions in use within readability.

var articleParagraphs = articleContent.getElementsByTagName('p');
for (i = articleParagraphs.length - 1; i >= 0; i--) {
for (var i = articleParagraphs.length - 1; i >= 0; i--) {
var imgCount = articleParagraphs[i].getElementsByTagName('img').length;

@@ -527,0 +527,0 @@ var embedCount = articleParagraphs[i].getElementsByTagName('embed').length;

var jsdom = require('jsdom'),
fetchUrl = require("fetch").fetchUrl,
helpers = require('./helpers')
fetchUrl = require('fetch').fetchUrl,
helpers = require('./helpers');

@@ -11,3 +11,3 @@ exports.debug = function (debug) {

function Readablity(document, options) {
function Readablity(document) {
this._document = document;

@@ -32,7 +32,7 @@ this.iframeLoads = 0;

articleContent = helpers.grabArticle(this._document);
if (helpers.getInnerText(articleContent, false) === "") {
this._document.body.innerHTML = this.cache['body'];
var articleContent = helpers.grabArticle(this._document);
if (helpers.getInnerText(articleContent, false) === '') {
this._document.body.innerHTML = this.cache.body;
articleContent = helpers.grabArticle(this._document, true);
if (helpers.getInnerText(articleContent, false) === "") {
if (helpers.getInnerText(articleContent, false) === '') {
return this.cache['article-content'] = false;

@@ -43,3 +43,3 @@ }

return this.cache['article-content'] = articleContent.innerHTML;
}
};

@@ -69,11 +69,11 @@ Readablity.prototype.getTitle = function () {

return this.cache['article-title'] = title;
}
};
Readablity.prototype.getDocument = function () {
return this._document;
}
};
Readablity.prototype.getHTML = function () {
return this._document.getElementsByTagName('html')[0].innerHTML;
}
};

@@ -93,2 +93,6 @@ function read(html, options, callback) {

function jsdomParse(error, meta, body) {
if (error) {
return callback(error);
}
if (typeof body !== 'string') body = body.toString();

@@ -108,2 +112,2 @@ jsdom.env({

module.exports.read = read;
module.exports.read = read;
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc