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 2.1.5 to 2.2.0

26

CHANGELOG.md

@@ -1,24 +0,4 @@

<a name="2.1.5"></a>
## [2.1.5](https://github.com/luin/node-readability/compare/v2.1.4...v2.1.5) (2016-01-31)
<a name="2.2.0"></a>
## [2.2.0](https://github.com/luin/node-readability/compare/v2.1.5...v2.2.0) (2016-03-11)
<a name="2.1.4"></a>
## [2.1.4](https://github.com/luin/node-readability/compare/v2.1.3...v2.1.4) (2016-01-31)
<a name="2.1.3"></a>
## [2.1.3](https://github.com/luin/node-readability/compare/v2.1.2...v2.1.3) (2016-01-31)
<a name="2.1.2"></a>
## [2.1.2](https://github.com/luin/node-readability/compare/v2.1.1...v2.1.2) (2016-01-31)
* Add `textBody` property.

2

package.json
{
"name": "node-readability",
"version": "2.1.5",
"version": "2.2.0",
"author": "Zihua Li",

@@ -5,0 +5,0 @@ "description": "Turning any web page into a clean view.",

@@ -110,2 +110,6 @@ # Readability

### textBody
A string containing all the text found on the page
### html

@@ -112,0 +116,0 @@

@@ -138,3 +138,3 @@ var url = require("url");

// If this paragraph is less than 25 characters, don't even count it.
// If this paragraph is less than 25 characters, don't even count it.
if (innerText.length < 25) continue;

@@ -649,3 +649,3 @@

}
if (node.attributes.itemscope) {

@@ -652,0 +652,0 @@ node.readability.contentScore += 5;

@@ -35,2 +35,5 @@ var jsdom = require('jsdom');

});
this.__defineGetter__('textBody', function() {
return this.getTextBody(true);
});
this.__defineGetter__('html', function() {

@@ -100,2 +103,27 @@ return this.getHTML(true);

Readability.prototype.getTextBody = function(notDeprecated) {
if (!notDeprecated) {
console.warn('The method `getTextBody()` is deprecated, using `textBody` property instead.');
}
if (typeof this.cache['article-text-body'] !== 'undefined') {
return this.cache['article-text-body'];
}
var articleContent = helpers.grabArticle(this._document);
var rootElement = articleContent.childNodes[0];
var textBody = '';
if (rootElement) {
var textElements = rootElement.childNodes;
for (var i = 0; i < textElements.length; i++) {
var el = textElements[i];
var text = helpers.getInnerText(el);
if (!text) continue;
textBody += text;
if ((i + 1) < textElements.length) textBody += '\n';
}
}
return this.cache['article-text-body'] = textBody;
}
Readability.prototype.getDocument = function(notDeprecated) {

@@ -102,0 +130,0 @@ if (!notDeprecated) {

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