-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
46 lines (41 loc) · 1.25 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const scraper = require('./index')
var args = process.argv.slice(2);
const model = args[0];
const response = { send: console.info, status: () => response }
const run = async () => {
let data = await scraper.crawlersingle(
{
body: {
"name": "example",
"task": {
"url": "https://ionicabizau.net",
"schema": {
"title": ".header h1",
"avatar": {
"selector": ".header img[src]",
"attr": "src",
"eq": 0,
"trim": true
},
"desc": {
"selector":".header h2",
"attr": "innerHTML"
},
"menu":{
"listItem": ".pages > li",
"data": {
"name": "a"
}
}
}
}
}
},
response
)
console.log(JSON.stringify(data))
}
(async function(){
await run()
process.exit(0)
})()