-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.js
61 lines (51 loc) · 2.13 KB
/
lib.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
async function scrapeBrand(input) {
let reg = /<td role="gridcell" style="" title="[a-zA-Z0-9@;:&'°#!\.\(\)-_%\$\^\*,\+\\\/ ]+" aria-describedby="gridForsearch_pane_BRAND">([a-zA-Z0-9@;:&'°#!\.\(\)-_%\$\^\*,\+\\\/ ]+)<\/td>/g;
let match = input.match(reg);
let reg2 = /title="([a-zA-Z0-9@;:&'°#!\.\(\)-_%\$\^\*,\+\\\/ ]+)"/;
let matches = [];
for(x = 0; x<match.length; x++) {
matches.push(match[x].match(reg2)[1]);
}
return matches;
}
async function scrapeStatus(input) {
let reg = /<td role="gridcell" style="" title="[a-zA-Z]+" aria-describedby="gridForsearch_pane_STATUS">([a-zA-Z]+)<\/td>/g;
let match = input.match(reg);
let reg2 = /title="([a-zA-Z]+)"/;
let matches = [];
for(x = 0; x<match.length; x++) {
matches.push(match[x].match(reg2)[1]);
}
return matches;
}
async function scrapeOrigin(input) {
let reg = /<td role="gridcell" style="text-align:right;" title="[a-zA-Z]+" aria-describedby="gridForsearch_pane_OO">([a-zA-Z]+)<\/td>/g;
let match = input.match(reg);
let reg2 = /title="([a-zA-Z]+)"/;
let matches = [];
for(x = 0; x<match.length; x++) {
matches.push(match[x].match(reg2)[1]);
}
return matches;
}
async function scrapeOwner(input) {
let reg = /<td role="gridcell" style="" title="[a-zA-Z0-9@;:&'°#!\.\(\)-_%\$\^\*,\+\\\/ ]+" aria-describedby="gridForsearch_pane_HOL">([a-zA-Z0-9@;:&'°#!\.\(\)-_%\$\^\*,\+\\\/ ]+)<\/td>/g;
let match = input.match(reg);
let reg2 = /title="([a-zA-Z0-9@;:&'°#!\.\(\)-_%\$\^\*,\+\\\/ ]+)"/;
let matches = [];
for(x = 0; x<match.length; x++) {
matches.push(match[x].match(reg2)[1]);
}
return matches;
}
async function scrapeDate(input) {
let reg = /<td role="gridcell" style="text-align:right;" title="[0-9\-]+" aria-describedby="gridForsearch_pane_AD">([0-9\-]+)<\/td>/g;
let match = input.match(reg);
let reg2 = /title="([0-9\-]+)"/;
let matches = [];
for(x = 0; x<match.length; x++) {
matches.push(match[x].match(reg2)[1]);
}
return matches;
}
module.exports = { scrapeBrand, scrapeStatus, scrapeOrigin, scrapeOwner, scrapeDate };