Socket
Socket
Sign inDemoInstall

node-readability

Package Overview
Dependencies
3
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.1.0

2

package.json
{
"name": "node-readability",
"version": "2.0.0",
"version": "2.1.0",
"author": "Zihua Li",

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

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

// EXPERIMENTAL
node.childNodes._toArray().forEach(function(childNode) {
Array.prototype.slice.call(node.childNodes).forEach(function(childNode) {
if (childNode.nodeType == 3 /*TEXT_NODE*/ ) {

@@ -113,0 +113,0 @@ // use span instead of p. Need more tests.

@@ -7,17 +7,14 @@ require('./mock-helpers.js');

var filePath = path.join(__dirname, 'test.html');
describe('charset', function () {
describe('setted in the html', function () {
it('should convert the page to utf-8', function (done) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, html) {
read(html, function (err, read) {
read.content.should.include('谷歌');
read.title.should.include('谷歌');
done();
});
});
describe('setted in the html', function () {
it('should convert the page to utf-8', function (done) {
fs.readFile(path.join(__dirname, 'test.html'), { encoding: 'utf-8' }, function (err, html) {
read(html, function (err, read) {
read.content.should.include('谷歌');
read.title.should.include('谷歌');
done();
});
});
});
});
});

@@ -34,21 +34,19 @@ require('./mock-helpers.js');

it('should preprocess document', function(done) {
read('http://colorlines.com/archives/2011/08/dispatch_from_angola_faith-based_slavery_in_a_louisiana_prison.html',
{
preprocess: function(source, response, content_type, callback) {
should.exist(source);
source.length.should.equal(50734);
should.exist(response);
should.exist(response.headers);
should.exist(content_type);
should.exist(content_type.charset);
callback(null, '<html><head><title>some other title</title></head><body></body></html>');
}
},
function(err, read) {
should.not.exist(err);
should.exist(read);
read.title.should.equal('some other title')
read.content.should.equal(false);
done();
});
read('http://colorlines.com/archives/2011/08/dispatch_from_angola_faith-based_slavery_in_a_louisiana_prison.html', {
preprocess: function(source, response, content_type, callback) {
should.exist(source);
source.length.should.equal(50734);
should.exist(response);
should.exist(response.headers);
should.exist(content_type);
should.exist(content_type.charset);
callback(null, '<html><head><title>some other title</title></head><body></body></html>');
}
}, function(err, read) {
should.not.exist(err);
should.exist(read);
read.title.should.equal('some other title')
read.content.should.equal(false);
done();
});
});

@@ -74,6 +72,4 @@

});
});
});
});

@@ -6,12 +6,11 @@ require('./mock-helpers.js');

it('should return the result', function(done) {
read('http://colorlines.com/archives/2011/08/dispatch_from_angola_faith-based_slavery_in_a_louisiana_prison.html',
function(err, read) {
var dom = read.document;
var html = '<html><head><meta charset="utf-8"><title>' + dom.title +
'</title></head><body><h1>' + read.title + '</h1>' + read.content + '</body></html>';
html.should.include('<title>Dispatch From Angola: Faith-Based Slavery in a Louisiana Prison');
read.close.should.be.a.Function
read.close();
done();
});
read('http://colorlines.com/archives/2011/08/dispatch_from_angola_faith-based_slavery_in_a_louisiana_prison.html', function(err, read) {
var dom = read.document;
var html = '<html><head><meta charset="utf-8"><title>' + dom.title +
'</title></head><body><h1>' + read.title + '</h1>' + read.content + '</body></html>';
html.should.include('<title>Dispatch From Angola: Faith-Based Slavery in a Louisiana Prison');
read.close.should.be.a.Function
read.close();
done();
});
});

@@ -18,0 +17,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc