goldwasher-needle
v2.1.0
Published
Plugin for goldwasher to add needle for easy HTTP requests.
Downloads
29
Maintainers
Readme
node-goldwasher-needle
Plugin for goldwasher to add needle for easy HTTP requests. Uses retry for robustness. Requires goldwasher to work. If you want to run this as a web server/service, have a look at the module hapi-goldwasher.
Installation
npm install goldwasher-needle
Options
Options can be optionally passed in as the second parameter, as an object with a property goldwasher
for goldwasher options, a property needle
for needle options and a property retry
for retry options. For instance:
var options = {
goldwasher: {
selector: 'h1'
},
needle: {
follow_max: 20,
read_timeout: 30000
},
retry: {
retries: 3
}
}
Have a look at their respective doc pages for goldwasher, needle and retry for options available.
Example
var gn = require('goldwasher-needle');
gn('http://www.google.com', function(error, result) {
console.log(result);
});
Advanced example
var gn = require('goldwasher-needle');
var url = 'http://www.google.com';
var options = {
goldwasher: {
selector: 'h1, h2, h3, h4, h5, h6, p'
}
};
gn(url, options, function(error, result) {
console.log(result);
});