forked from Wenmoux/checkbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4399_fulizx.js
90 lines (82 loc) · 3.04 KB
/
4399_fulizx.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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const axios = require("axios")
var strcode = ""
var name = []
const device = config.youlecheng.device
const scookie = config.youlecheng.scookie
cc = null
const UA = config.youlecheng.UA ? config.youlecheng.UA : "..."
var sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
function get(b, p, log) {
return new Promise(async resolve => {
try {
let path = "fulizhongxin"
if (p) path = "fulizhongxin2"
let url = `https://yxhhd2.5054399.com/comm/${path}/ajax.php?ac=${b}&strcode=${strcode}&scookie=${scookie}&device=${device}`
if(b.match(/num/)) url += "&cccc="+cc
let res = await axios.get(url, {
headers: {
"User-Agent": UA,
"Referer": "https://yxhhd2.5054399.com/2019/fxyxtq2/"
}
})
resolve(res.data)
if (res.data.msg && !log && !res.data.msg.match(/没有此任务/)) {
console.log(" " + res.data.msg)
}
} catch (err) {
resolve({
key: err.code,
msg: err.msg ?? err.code
})
}
resolve()
})
}
async function dotask(code, cha) {
strcode = encodeURIComponent(code.match(/strcode=(.+)/)[1])
console.log(strcode)
userinfo = ""
p = null
if (code.match(/fulizhongxin2/)) p = 1
let res = await get("do_init", p, true)
if (res.key == 200) {
userinfo = `${gamename}: ${res.suipian}\n`
cc = res.cccccccc ? res.cccccccc : null
if (!cha) {
await get("do_share", p)
for (i of [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13]) {
let gres = await get(`get_num&id=${i}`, p)
if (gres && gres.msg && !gres.msg.match(/没有此任务/)) await get("choujiang", p)
await sleep(1500)
}
} else console.log(userinfo)
} else userinfo = res.msg
console.log(userinfo)
return userinfo
}
async function task() {
if (UA) {
yxinfo = "【4399游戏福利社】: \n"
let startKey = 0
k = 0
more = true
for (i = 0; more; i++) {
let res = await axios.post('https://mapi.yxhapi.com/android/box/other/v1.0/huodong-search.html', `startKey=${startKey}&keyword=%E7%A6%8F%E5%88%A9%E4%B8%AD%E5%BF%83&n=20`)
if (res.data.result.more != 1) more = false
else startKey = res.data.result.startKey
for (game of res.data.result.data) {
if(game.id != 9199){
gamename =game.title.match(/《(.+)》/)&& game.title.match(/《(.+)》/)[1]
console.log(gamename)
console.log("过期时间:"+ new Date(parseInt(game.etime) * 1000).toLocaleString())
yxinfo += await dotask(game.cli_url)
console.log("\n\n")
await sleep(5*1000)
}
}
}
} else return "请先填写你的User-Agent再运行脚本"
return yxinfo
}
//task()
module.exports = task;