-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
36 lines (32 loc) · 840 Bytes
/
main.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
const config = {
sort: 1, // 1为热门 2为时间
Take: 3, // 读取作品的数量1-100
Days: 30, // 读取n天内的作品
Tags: [],
};
const Pl = require("physics-lab-web-api");
const User = Pl.User;
const map = new Map();
async function main() {
const pl = new User(null, null);
await pl.auth.login();
const re = await pl.projects.query("Discussion", config);
for (const i of re.Data.$values) {
const getSupporters = await pl.projects.getSupporters(
i.ID,
"Discussion",
50
);
const users = getSupporters.Data.$values;
users.map((user) => {
user.ID = user.Nickname;
if (map.has(user.ID)) {
map.set(user.ID, map.get(user.ID) + 1);
} else {
map.set(user.ID, 1);
}
});
}
console.table([...map].sort((a, b) => -a[1] + b[1]));
}
main();