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 1.0.0 to 1.0.1

2

package.json
{
"name": "node-readability",
"version": "1.0.0",
"version": "1.0.1",
"author": "Zihua Li",

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

@@ -34,21 +34,21 @@ # Readability

```javascript
var read = require('node-readability');
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);
read('http://howtonode.org/really-simple-file-uploads', function(err, article, meta) {
// Main Article
console.log(article.content);
// Title
console.log(article.title);
// HTML Source Code
console.log(article.html);
// DOM
console.log(article.document);
// HTML Source Code
console.log(article.html);
// DOM
console.log(article.document);
// Response Object from Request Lib
console.log(meta);
// Response Object from Request Lib
console.log(meta);
// Close article to clean up jsdom and prevent leaks
article.close();
});
// Close article to clean up jsdom and prevent leaks
article.close();
});
```

@@ -70,12 +70,13 @@ **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.

read(url, {
cleanRulers : [
function(obj, tag) {
if(tag === 'object') {
if(obj.getAttribute('class') === 'BrightcoveExperience') {
return true;
}
}
}
]
}, function(err, article, response) {});
cleanRulers: [
function(obj, tag) {
if(tag === 'object') {
if(obj.getAttribute('class') === 'BrightcoveExperience') {
return true;
}
}
}
]}, function(err, article, response) {
//...
});
```

@@ -85,6 +86,6 @@

options.preprocess = callback(source, response, content_type, callback);
options.preprocess = callback(source, response, contentType, callback);
```javascript
read(url, {
preprocess: function(source, response, content_type, callback) {
preprocess: function(source, response, contentType, callback) {
if (source.length > maxBodySize) {

@@ -97,3 +98,2 @@ return callback(new Error('too big'));

});
```

@@ -100,0 +100,0 @@

@@ -152,3 +152,3 @@ var jsdom = require('jsdom');

return {
mimeType: (mimeType  ||  "").trim().toLowerCase(),
mimeType: (mimeType || "").trim().toLowerCase(),
charset: (charset || "UTF-8").trim().toLowerCase() // defaults to UTF-8

@@ -182,3 +182,3 @@ };

content_type.charset = (overrideEncoding ||  content_type.charset ||  "utf-8").trim().toLowerCase();
content_type.charset = (overrideEncoding || content_type.charset || "utf-8").trim().toLowerCase();

@@ -221,11 +221,20 @@ if (!content_type.charset.match(/^utf-?8$/i)) {

if (errors) {
window.close();
return callback(errors);
window.close();
return callback(errors);
}
if (!window.document.body) {
window.close();
return callback(new Error('No body tag was found.'));
window.close();
return callback(new Error('No body tag was found.'));
}
// add meta information to callback
callback(null, new Readability(window, options), meta);
try {
var readability = new Readability(window, options);
// add meta information to callback
callback(null, readability, meta);
} catch (ex) {
window.close();
return callback(ex);
}
}

@@ -232,0 +241,0 @@ });

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