release
This commit is contained in:
parent
9b41d509b3
commit
8826cd2ba8
19
package.json
19
package.json
|
@ -1,4 +1,9 @@
|
||||||
{
|
{
|
||||||
|
"name": "deblan-scraper",
|
||||||
|
"description": "Web scraper using CSS selector",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"devDependencies": {},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^1.0.0-rc.3",
|
"cheerio": "^1.0.0-rc.3",
|
||||||
"extends-classes": "^1.0.5",
|
"extends-classes": "^1.0.5",
|
||||||
|
@ -6,5 +11,17 @@
|
||||||
"request-promise": "^4.2.5",
|
"request-promise": "^4.2.5",
|
||||||
"striptags": "^3.1.1",
|
"striptags": "^3.1.1",
|
||||||
"trim": "^0.0.1"
|
"trim": "^0.0.1"
|
||||||
}
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitnet.fr/deblan/scraper.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"scraper"
|
||||||
|
],
|
||||||
|
"author": "Simon Vieille <contact@deblan.fr> (https://www.deblan.io)",
|
||||||
|
"license": "ISC"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ class Input {
|
||||||
* @param object process
|
* @param object process
|
||||||
*/
|
*/
|
||||||
constructor(process) {
|
constructor(process) {
|
||||||
this.args = Minimist(process.argv.slice(2));
|
this.args = Minimist(process.argv.slice(2))
|
||||||
this.node = process.argv[0];
|
this.node = process.argv[0]
|
||||||
this.script = process.argv[1];
|
this.script = process.argv[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,11 +24,11 @@ class Input {
|
||||||
*/
|
*/
|
||||||
get(name, defaultValue) {
|
get(name, defaultValue) {
|
||||||
if (this.has(name)) {
|
if (this.has(name)) {
|
||||||
return this.args[name];
|
return this.args[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultValue !== undefined) {
|
if (defaultValue !== undefined) {
|
||||||
return defaultValue;
|
return defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -42,7 +42,7 @@ class Input {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
has(name) {
|
has(name) {
|
||||||
return this.args.hasOwnProperty(name);
|
return this.args.hasOwnProperty(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ class Input {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
empty() {
|
empty() {
|
||||||
return Object.keys(this.args).length === 1;
|
return Object.keys(this.args).length === 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,15 @@ class Output {
|
||||||
data,
|
data,
|
||||||
function(key, value) {
|
function(key, value) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value
|
||||||
},
|
},
|
||||||
pretty ? 2 : null
|
pretty ? 2 : null
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.write(data);
|
return this.write(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,9 +35,9 @@ Optional parameters
|
||||||
HTTP
|
HTTP
|
||||||
|
|
||||||
--method [METHOD] HTTP Method
|
--method [METHOD] HTTP Method
|
||||||
--accept-http-error Accepts all status code (like 404)
|
--accept-http-error Accepts all status codes (like 404)
|
||||||
|
|
||||||
--verbose, -v Show message of error
|
--verbose, -v Show message of error
|
||||||
`
|
`
|
||||||
|
|
||||||
if (input.has('help')) {
|
if (input.has('help')) {
|
||||||
|
|
Loading…
Reference in a new issue