add documentation
This commit is contained in:
parent
229242ed11
commit
5619191a00
32
README.md
32
README.md
|
@ -31,30 +31,30 @@ With code
|
||||||
const scraper = require('deblan-scraper')
|
const scraper = require('deblan-scraper')
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
url: 'https://github.com/foo/bar',
|
url: 'https://github.com/foo/bar',
|
||||||
acceptAllStatus: false, // Optional
|
acceptAllStatus: false, // Optional, default is `false`
|
||||||
method: 'GET', // Optional
|
method: 'GET', // Optional, default is `GET`
|
||||||
}
|
}
|
||||||
|
|
||||||
const selector = '.repository-content .numbers-summary li:nth-child(4) a'
|
const selector = '.repository-content .numbers-summary li:nth-child(4) a'
|
||||||
|
|
||||||
const filters = {
|
const filters = {
|
||||||
tags: null,
|
tags: null, // Removes tags. You can specify the tags to remove (separated by comma)
|
||||||
breaks: null,
|
breaks: null, // Removes breaks (\n, \r)
|
||||||
spaces: null,
|
spaces: null, // Replaces 2 successive spaces by 1, except breaks
|
||||||
trim: null,
|
trim: null, // Strips whitespaces from the beginning and end of the value
|
||||||
}
|
}
|
||||||
|
|
||||||
scraper(
|
scraper(
|
||||||
options,
|
options,
|
||||||
selector,
|
selector,
|
||||||
filters,
|
filters,
|
||||||
function(value) {
|
function(value) {
|
||||||
console.log(value)
|
console.log(value)
|
||||||
},
|
},
|
||||||
function(error) {
|
function(error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue