-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrapperHelper.js
More file actions
69 lines (62 loc) · 1.37 KB
/
scrapperHelper.js
File metadata and controls
69 lines (62 loc) · 1.37 KB
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
62
63
64
65
66
67
68
69
/**
* @class
**/
const ScrapperHelperClass = class{
/**
* @type minerToolClass
* @private
**/
#mT = new MinerToolClass('scrapper', 4, 20);
/**
* @param {string}
* @param {string}
* @private
**/
#log = this.#mT.log;
/**
* @param {string} // @param {str}
* @constructor
**/
constructor(url_) {
this.cH = new CoolHelperClass();
this.nH = new NetHelperClass(url_);
}
/**
*
* @param {string}
* @param {Object.<string, string>} // @param {map<str,str>}
* @public
* @returns {Object.<string, string>} // @return {map<str,str>}
**/
searchObject(id_, data_){
let search = {};
search[id_] = data_[id_];
return search;
};
/**
*
* @param {DOMElement}
* @param {ScrapMeta}
* @param {string} // @param {str}
* @public
**/
async mineAndSave(e_, meta_, id_){
const mined = this.cH.iTextss(
e_, meta_
);
this.#log('mineAndSave', 'mine done');
this.#log('mineAndSave',
(
'size : '+
mined.length.toString()
)
);
for (const i of mined){
await this.nH.checkAndAdd(
this.searchObject(id_, i),
i
);
}
this.#log('mineAndSave','save done');
}
};