boilerpipe-scraper
Advanced tools
Comparing version
26
index.js
@@ -1,14 +0,14 @@ | ||
var exec = require('child_process').exec; | ||
const exec = require('child_process').exec | ||
module.exports = function (url, proxy, callback) { | ||
var proc = ''; | ||
if (typeof proxy === 'string') proc = 'java -jar ' + __dirname + '/boilerpipe.jar ' + url + ' \"' + proxy + '\"'; | ||
else { | ||
callback = proxy; | ||
proc = 'java -jar ' + __dirname + '/boilerpipe.jar ' + ' \"' + url + '\"'; | ||
} | ||
exec(proc, { timeout : 60000 }, function (error, stdout, stderr) { | ||
if (error) callback(error); | ||
else callback(null, stdout); | ||
}); | ||
}; | ||
module.exports = (url, proxy, callback) => { | ||
var proc | ||
if (typeof proxy === 'string') proc = `java -jar ${__dirname}/boilerpipe.jar ${url} "${proxy}"` | ||
else { | ||
callback = proxy | ||
proc = `java -jar ${__dirname}/boilerpipe.jar "${url}"` | ||
} | ||
exec(proc, { timeout : 60000 }, (error, stdout, stderr) => { | ||
if (error) callback(error) | ||
else callback(null, stdout) | ||
}) | ||
} |
{ | ||
"name": "boilerpipe-scraper", | ||
"version": "0.0.27", | ||
"version": "1.0.0", | ||
"description": "Boilerpipe Modification for Node.js", | ||
@@ -15,8 +15,8 @@ "main": "index.js", | ||
], | ||
"author": "Josep Subils", | ||
"license": "ISC", | ||
"author": "Josep Subils <js@js.gl> (http://js.gl)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/warlock/boilerpipe-scraper/issues" | ||
}, | ||
"homepage": "https://github.com/warlock/boilerpipe-scraper" | ||
"homepage": "https://js.gl" | ||
} |
@@ -1,2 +0,2 @@ | ||
##BOILERPIPE | ||
## BOILERPIPE | ||
Boilerpipe with modifications. In unique instance: | ||
@@ -8,6 +8,10 @@ - Request in multiple proxy's. | ||
### Load | ||
```javascript | ||
var boiler = require('boilerpipe-scraper') | ||
const boiler = require('boilerpipe-scraper') | ||
``` | ||
boiler("http://www.spellbook.io", "192.168.0.1:3128 192.168.0.2:3128", (err, text) => { | ||
### Basic usage | ||
```javascript | ||
boiler("http://www.js.gl", (err, text) => { | ||
if (err) console.log(err) | ||
@@ -18,2 +22,21 @@ else console.log(text) | ||
### Usage with proxies | ||
```javascript | ||
boiler("http://www.js.gl", "192.168.0.1:3128 192.168.0.2:3128", (err, text) => { | ||
if (err) console.log(err) | ||
else console.log(text) | ||
}) | ||
``` | ||
### That lib requires the Java VM | ||
## License | ||
``` | ||
The MIT License (MIT) Copyright (c) 2015 Josep Subils (js@js.gl) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
``` |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1488784
0.08%41
127.78%