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.3.3 to 0.4.0

examples/after.png

4

package.json
{
"name": "node-readability",
"version": "0.3.3",
"version": "0.4.0",
"author": "Zihua Li",

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

"dependencies": {
"jsdom": "0.8.x",
"jsdom": "0.11.1",
"request": "~2.40.0",

@@ -25,0 +25,0 @@ "encoding": "~0.1.7"

@@ -7,3 +7,3 @@ # Readability

### Features
## Features
1. Optimized for more websites.

@@ -13,2 +13,6 @@ 2. Support encodings such as GBK and GB2312.

## Example
[Before](https://raw.githubusercontent.com/luin/node-readability/master/examples/before.png) -> [After](https://raw.githubusercontent.com/luin/node-readability/master/examples/after.png)
## Install

@@ -15,0 +19,0 @@

@@ -14,12 +14,2 @@ require('./mock-helpers.js');

});
describe('setted in the html', function() {
it('should convert the page to utf-8', function(done) {
read('http://news.163.com/14/0116/19/9IO1RJMO00014JB6.html', function(err, read) {
read.content.should.include('朝鲜');
read.title.should.include('朝鲜');
done();
});
});
});
});
require('./mock-helpers.js');
var read = require('../src/readability');
describe('parameters', function () {
describe('parameters', function() {
describe('html', function() {

@@ -13,4 +13,4 @@ it('should accept a html', function(done) {

it('should throw when missing body tag', function (done) {
read('<html><head><title>hi</title></head>hi!</html>', function (err, read) {
it('should throw when missing body tag', function(done) {
read('<html><head><title>hi</title></head>hi!</html>', function(err, read) {
err.message.should.equal('No body tag was found.');

@@ -22,3 +22,3 @@ done();

it('should not resolve the url', function(done) {
read('<html><body><img src="image.png"></a></body></html>', function(err, read){
read('<html><body><img src="image.png"></a></body></html>', function(err, read) {
read.document.body.innerHTML.should.include('src="image.png"');

@@ -42,3 +42,1 @@ done();

});
require('./mock-helpers.js');
var read = require('../src/readability');
describe('result', function () {
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 - COLORLINES</title>');
done();
});
describe('result', function() {
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 - COLORLINES</title>');
done();
});
});
it('should get document with frames', function (done) {
it('should get document with frames', function(done) {
read('http://www.whitehouse.gov/', function(err, read) {

@@ -23,3 +25,3 @@ var dom = read.document;

it('should handle frames', function(done) {
read('<html><body><frame /><frame />Hello world!</body></html>', function(err, read){
read('<html><body><frame /><frame />Hello world!</body></html>', function(err, read) {
read.document.body.innerHTML.should.include('Hello world!');

@@ -30,2 +32,1 @@ done();

});
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc