forked from jianggaocheng/mihoyo-signin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
44 lines (33 loc) · 1.18 KB
/
index.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
const _ = require('lodash');
const async = require('async');
const utils = require('./lib/utils');
const FORUM_MAP = require('./lib/mihoyo/forum-map');
const forumSignIn = require('./lib/mihoyo/forum-sign');
const forumPostList = require('./lib/mihoyo/forum-post-list');
const forumPostDetail = require('./lib/mihoyo/forum-post-detail');
const forumPostVote = require('./lib/mihoyo/forum-post-vote');
const forumPostShare = require('./lib/mihoyo/forum-post-share');
const { post } = require('superagent');
// Init
require('./lib/global').init();
const init = async function() {
// Sign In
await async.eachSeries(FORUM_MAP, async (forum) => {
await forumSignIn(forum);
await utils.randomSleepAsync();
});
// Read, vote, share
await async.eachSeries(FORUM_MAP, async (forum) => {
let postList = await forumPostList(forum);
await utils.randomSleepAsync();
await async.eachSeries(postList, async ({post}) => {
await forumPostDetail(post);
await utils.randomSleepAsync();
await forumPostVote(post);
await utils.randomSleepAsync();
});
let sharePost = postList[postList.length - 1];
await forumPostShare(sharePost.post);
});
};
init();