New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

read-art

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-art - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

2

examples/simple.js

@@ -17,3 +17,3 @@ var read = require('../');

}
}, function(err, art){
}, function(err, art, options, resp){
if (err) {

@@ -20,0 +20,0 @@ console.log('[ERROR]', err.message);

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

# 2015/06/03
- Add response data to callback arguments
# 2015/03/10

@@ -2,0 +5,0 @@ - Remove empty content in JSON output mode

@@ -61,3 +61,4 @@ "use strict";

parsingData.html = resp.body.toString();
parse(parsingData);
delete resp.body;
parse(parsingData, resp);
});

@@ -78,5 +79,6 @@ } else {

* @param o options
* @param e extra data
* @return {String}
*/
function parse(o){
function parse(o, e){
if (!o.html) {

@@ -98,3 +100,3 @@ return '';

var $ = cheerio.load(o.html, co);
o.callback(null, new Article($, o.options), o.options);
o.callback(null, new Article($, o.options), o.options, e);
}
{
"name": "read-art",
"version": "0.3.4",
"version": "0.3.5",
"description": "Scrape/Crawl article from any site automatically. Make any web page readable, no matter Chinese or English.",

@@ -32,4 +32,4 @@ "main": "index.js",

"dependencies": {
"cheerio": "~0.18.0",
"req-fast": "^0.2.7",
"cheerio": "~0.19.0",
"req-fast": "^0.2.8",
"URIjs": "^1.14.0",

@@ -36,0 +36,0 @@ "entities": "~1.1.1"

@@ -72,3 +72,7 @@ read-art [![NPM version](https://badge.fury.io/js/read-art.svg)](http://badge.fury.io/js/read-art) [![Build Status](https://travis-ci.org/Tjatse/node-readability.svg?branch=master)](https://travis-ci.org/Tjatse/node-readability)

- **node** The [cheerio object](https://github.com/cheeriojs/cheerio#selectors).
* **callback** The callback to run - `callback(error, article, options)`
* **callback** The callback to run - `callback(error, article, options, response)`, arguments are:
- **error** `Error` object when exception has been caught.
- **article** The article object, including: `article.title`, `article.content` and `article.html`.
- **options** The request options.
- **response** The response of your request, including: `response.headers`, `response.redirects`, `response.cookies` and `response.statusCode`.

@@ -82,3 +86,3 @@ > Head over to test or examples directory for a complete example.

// read from google:
read('http://google.com', function(err, art, options){
read('http://google.com', function(err, art, options, resp){
if(err){

@@ -90,2 +94,4 @@ throw err;

html = art.html; // whole original innerHTML
console.log('[STATUS CODE]', resp && resp.statusCode);
});

@@ -96,7 +102,7 @@ // or:

charset: 'utf8'
}, function(err, art, options){
}, function(err, art, options, resp){
});
// what about html?
read('<title>node-art</title><body><div><p>hello, read-art!</p></div></body>', function(err, art, options){
read('<title>node-art</title><body><div><p>hello, read-art!</p></div></body>', function(err, art, options, resp){

@@ -107,3 +113,3 @@ });

uri: '<title>node-art</title><body><div><p>hello, read-art!</p></div></body>'
}, function(err, art, options){
}, function(err, art, options, resp){

@@ -110,0 +116,0 @@ });

@@ -10,3 +10,12 @@ var read = require('../'),

it('should have title & content',function(done){
read('http://www.theatlantic.com/international/archive/2014/05/the-last-man-at-nuremberg/361968/', function(err, art){
read({
uri: 'http://www.theatlantic.com/international/archive/2014/05/the-last-man-at-nuremberg/361968/',
scoreRule: function(node){
var id = node.attr('id');
if (id == 'article-section-1') {
return 100
}
return 0;
}
}, function(err, art){
should.not.exist(err);

@@ -13,0 +22,0 @@ expect(art).to.be.an('object');

@@ -11,3 +11,3 @@

before(function(){
uri = 'http://bing.com';
uri = 'http://www.bing.com';
html = '<p>Hello, node-art</p>';

@@ -23,6 +23,7 @@ charset = 'utf8';

it('should detect two options',function(done){
read(uri, { charset: charset }, function(err, art, options){
read(uri, { charset: charset }, function(err, art, options, resp){
should.not.exist(err);
options.uri.should.be.equal(uri);
options.charset.should.be.equal(charset);
resp.statusCode.should.be.equal(200)
done();

@@ -29,0 +30,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