-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.js
34 lines (27 loc) · 1.01 KB
/
functions.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
const fs = require('fs');
module.exports = {
cleanList: (siteList) => {
for (_site in siteList) {
let site = siteList[_site];
if (site.username_claimed) {
delete site.username_claimed;
}
if (site.username_unclaimed) {
delete site.username_unclaimed;
}
if (site.rank) {
delete site.rank;
}
}
fs.writeFileSync('./sites.json', JSON.stringify(siteList, null, 4), 'utf8');
return siteList;
},
usernameFound: (site, res, err = false) => {
if (site.errorType == 'status_code')
return res.statusCode == 200;
else if (site.errorType == 'message')
return err ? !(res.response.body.includes(site.errorMsg)) : !(res.body.includes(site.errorMsg));
else if (site.errorType == 'response_url' && res.request && res.request.uri && res.request.href)
return !(res.request.uri.href.includes(site.errorUrl));
}
}