-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
32 lines (22 loc) · 909 Bytes
/
app.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
'use strict'
const {getFollwedUsers, getUsersInfo, getZombieUsers, getParameters, writeJson} = require('./utils');
process.on('uncaughtException', function (err) {
console.log(err);
});
process.on('unhandledRejection', function(err, p) {
console.log(err.stack);
});
let username = getParameters();
if (!username) {
return console.log(`Usage: -username yourusername`);
}
;(async () => {
let followedUsers = await getFollwedUsers(username);
let {likeZombieUsers, followedUsersInfo} = await getUsersInfo(followedUsers);
writeJson(`${username}_all`, followedUsersInfo);
writeJson(`${username}_zombie`, likeZombieUsers);
let zombieUsers = getZombieUsers(likeZombieUsers);
let all = followedUsersInfo.length;
let zombie = zombieUsers.length;
console.log(`allFollowedUser: ${all}, zombieUser: ${zombie}, zombiePer: ${((zombie / all) * 100).toFixed(2)}%`);
})();