node-readability
Advanced tools
Comparing version 0.0.3 to 0.0.5
{ | ||
"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; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
25480
600