Skip to content

Commit 5279781

Browse files
committed
更新[米读],修复阅读双签,添加签到双签
1 parent e808f1b commit 5279781

4 files changed

Lines changed: 98 additions & 70 deletions

File tree

midu/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
> 2020.04.29 添加阅读时长
1010
> 2020.04.30 添加签到、掷骰子
1111
> 2002.05.01 添加阅读双签
12+
> 2002.05.01 添加签到双签
1213
## 配置 (Surge)
1314

1415
```properties
@@ -56,6 +57,7 @@ apiwz.midukanshu.com
5657
6. 建议将`miduRead.js`脚本`task`执行次数改成每分钟执行以达到阅读时长
5758
7. 若要双签到,切换账号获取账户二的Cookie即可
5859
8. 赞赏:邀请码`A1040276307`,[直达链接](http://html34.qukantoutiao.net/qpr2/bBmQ.html?pid=5eb14518)
60+
9. 无限账户签到请移步:[GideonSenku](https://github.com/GideonSenku/scripts/tree/master/midu),目前支持仅制支持Surge
5961
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
6062
6163
> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次.

midu/midu.cookie.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const readTimebodyKey = 'senku_readTimebody_midu'
21
// 账号一
32
const readTimeheaderKey = 'senku_readTimeheader_midu'
43
const signbodyKey = 'senku_signbody_midu'
@@ -23,14 +22,15 @@ if ($request && $request.method != 'OPTIONS' && requrl.match(/\/user\/readTimeBa
2322
var CookieName = '【账号一】'
2423
var CookieKey = 'senku_readTimeheader_midu'
2524
var tokenKey = 'tokenMidu_read'
25+
var readTimebodyKey = 'senku_readTimebody_midu'
2626
} else if (!account2 || tokenVal == account2) {
2727
var CookieName = '【账号二】'
2828
var CookieKey = 'senku_readTimeheader_midu2'
2929
var tokenKey = 'tokenMidu_read2'
30-
} else {
31-
senku.msg("米读", "更新米读->阅读Cookie失败", '非历史写入账号 ‼️')
30+
var readTimebodyKey = 'senku_readTimebody_midu2'
3231
}
33-
if (senku.getdata(tokenKey)) {
32+
senku.log(`🍎${CookieName}`)
33+
if (CookieName && senku.getdata(tokenKey)) {
3434
if (senku.getdata(tokenKey) != tokenVal) {
3535
var token = senku.setdata(tokenVal, tokenKey)
3636
var header = senku.setdata(JSON.stringify(CookieValue), CookieKey)
@@ -46,7 +46,7 @@ if ($request && $request.method != 'OPTIONS' && requrl.match(/\/user\/readTimeBa
4646
senku.msg("米读", "阅读", "更新" + CookieName + "Cookie成功 🎉")
4747
}
4848
}
49-
} else {
49+
} else if (CookieName) {
5050
var token = senku.setdata(tokenVal, tokenKey)
5151
var header = senku.setdata(JSON.stringify(CookieValue), CookieKey)
5252
var body = senku.setdata(readTimebodyVal, readTimebodyKey)
@@ -59,6 +59,8 @@ if ($request && $request.method != 'OPTIONS' && requrl.match(/\/user\/readTimeBa
5959
senku.msg("米读", "阅读文章数据", "获取Cookie成功 🎉")
6060
senku.msg("米读", "阅读", "首次写入" + CookieName + "Cookie成功 🎉")
6161
}
62+
} else {
63+
senku.msg("米读", "更新米读->阅读Cookie失败", '非历史写入账号 ‼️')
6264
}
6365

6466
} catch (error) {

midu/miduRead.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// 农妇山泉 -> 有点咸
44

55
const cookieName = '米读阅读时长'
6-
const readTimebodyKey = 'senku_readTimebody_midu'
76
// 账号一
87
const readTimeheaderKey = 'senku_readTimeheader_midu'
98
const signbodyKey = 'senku_signbody_midu'
@@ -14,17 +13,19 @@ const signbodyKey2 = 'senku_signbody_midu2'
1413
const tokenKey2 = 'tokenMidu_read2'
1514

1615
const senku = init()
17-
const readTimebodyVal = senku.getdata(readTimebodyKey)
18-
16+
const readTimebodyVal = senku.getdata('senku_readTimebody_midu')
17+
const readTimebodyVal2 = senku.getdata('senku_readTimebody_midu2')
1918
const readTimeheaderVal = senku.getdata(readTimeheaderKey)
2019
const readTimeheaderVal2 = senku.getdata(readTimeheaderKey2)
2120
const token = senku.getdata(tokenKey)
2221
const token2 = senku.getdata(tokenKey2)
2322
const readTimeurlVal = 'https://apiwz.midukanshu.com/user/readTimeBase/readTime?' + readTimebodyVal
23+
const readTimeurlVal2 = 'https://apiwz.midukanshu.com/user/readTimeBase/readTime?' + readTimebodyVal2
2424
const signinfo = {}
2525

2626
// 清除Cookie,将下方改为true,默认false
2727
const DeleteCookie = false
28+
2829
// 开启debug模式,每次脚本执行会显示通知,默认false
2930
const debug = false
3031
senku.log(`🍎${readTimeheaderVal}`)
@@ -46,20 +47,20 @@ debug ? senku.setdata('true', 'debug') : senku.setdata('false', 'debug')
4647
(sign = async () => {
4748
senku.log(`🔔 ${cookieName},token:${token} token2:${token2}`)
4849
if (token) {
49-
token == token2 ? senku.msg('米读阅读', '阅读token重复', '清除Cookie再试一次') : await readTime(readTimeheaderVal, '账号一')
50+
await readTime(readTimeheaderVal, readTimeurlVal, '账号一')
5051
}
51-
if (token2 && token2 != token) {
52-
await readTime(readTimeheaderVal2, '账号二')
52+
if (token2) {
53+
await readTime(readTimeheaderVal2, readTimeurlVal2, '账号二')
5354
}
5455
senku.done()
5556
})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done())
5657

5758

5859
// 阅读时长
59-
function readTime(header, account) {
60+
function readTime(header, urlVal, account) {
6061
return new Promise((resolve, reject) => {
6162
const url = {
62-
url: readTimeurlVal,
63+
url: urlVal,
6364
headers: JSON.parse(header)
6465
}
6566
senku.post(url, (error, response, data) => {
@@ -71,12 +72,13 @@ function readTime(header, account) {
7172
if (signinfo.readTime && signinfo.readTime.code == 0) {
7273
const coin = signinfo.readTime.data.coin
7374
const readTotalMinute = signinfo.readTime.data.readTotalMinute
75+
const total_coin = signinfo.readTime.data.total_coin
7476
coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰`
7577
if (readTotalMinute % 20 == 0) {
76-
readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟` : detail += ``
78+
readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰`
7779
senku.msg(cookieName, account + subTitle, detail)
7880
} else if (senku.getdata('debug') == 'true') {
79-
readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟` : detail += ``
81+
readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰`
8082
senku.msg(cookieName, account + subTitle, detail)
8183
}
8284
} else if (signinfo.readTime.code != 0) {

midu/miduSign.js

Lines changed: 77 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,61 @@
22
// 链接`http://html34.qukantoutiao.net/qpr2/bBmQ.html?pid=5eb14518`
33
// 农妇山泉 -> 有点咸
44
const cookieName = '米读'
5-
const signbodyKey = 'senku_signbody_midu'
65
const senku = init()
7-
const signbodyVal = senku.getdata(signbodyKey)
8-
const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2?' + signbodyVal
9-
const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward?' + signbodyVal
10-
const dice_index_urlVal = 'https://apiwz.midukanshu.com/wz/dice/index?' + signbodyVal
11-
const dice_roll_urlVal = 'https://apiwz.midukanshu.com/wz/dice/roll?' + signbodyVal
12-
const dice_double_urlVal = 'https://apiwz.midukanshu.com/wz/dice/doubleReward?' + signbodyVal
13-
const dice_addnum_urlVal = 'https://apiwz.midukanshu.com/wz/dice/addChangeNumByRewardVideo?' + signbodyVal
14-
const signinfo = {
15-
addnumList: [],
16-
rollList: [],
17-
doubleList: []
6+
7+
function initial() {
8+
signinfo = {
9+
addnumList: [],
10+
rollList: [],
11+
doubleList: []
12+
}
1813
}
1914

2015
;
21-
(sign = async () => {
16+
(sign = () => {
2217
senku.log(`🔔 ${cookieName}`)
23-
await signDay()
24-
await signVideo()
25-
await dice_index()
18+
if (senku.getdata('senku_signbody_midu')) {
19+
signbodyVal = senku.getdata('senku_signbody_midu')
20+
name = '账户一'
21+
all(name)
22+
}
23+
if (senku.getdata('senku_signbody_midu2')) {
24+
signbodyVal = senku.getdata('senku_signbody_midu2')
25+
name = '账户二'
26+
all(name)
27+
}
28+
if (!senku.getdata('senku_signbody_midu') && !senku.getdata('senku_signbody_midu2')) {
29+
senku.msg('米读签到', '', '不存在Cookie')
30+
}
31+
senku.done()
32+
})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done())
33+
34+
async function all(name) {
35+
senku.log(`🍎${name},${signbodyVal}`)
36+
const key = signbodyVal
37+
initial()
38+
await signDay(key)
39+
await signVideo(key)
40+
await dice_index(key)
2641
if (signinfo.dice_index && signinfo.dice_index.code == 0) {
2742
const remain_add_num = signinfo.dice_index.data.remain_add_chance_num
2843
const chance_num = signinfo.dice_index.data.chance_num
2944
for (let index = 0; index < remain_add_num; index++) {
3045
await dice_addnum()
3146
}
3247

33-
for (let index = 0; index < chance_num; index++) {
34-
await dice_roll()
35-
await dice_double()
48+
for (let index = 0; index < 8; index++) {
49+
await dice_roll(key)
50+
await dice_double(key)
3651
}
3752
}
38-
showmsg()
39-
senku.done()
40-
})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done())
41-
53+
await showmsg(name)
54+
}
4255

4356
// 骰子信息
4457
function dice_index() {
4558
return new Promise((resolve, reject) => {
59+
const dice_index_urlVal = 'https://apiwz.midukanshu.com/wz/dice/index?' + signbodyVal
4660
const url = {
4761
url: dice_index_urlVal,
4862
headers: {}
@@ -68,6 +82,7 @@ function dice_index() {
6882
// 掷骰子
6983
function dice_roll() {
7084
return new Promise((resolve, reject) => {
85+
const dice_roll_urlVal = 'https://apiwz.midukanshu.com/wz/dice/roll?' + signbodyVal
7186
const url = {
7287
url: dice_roll_urlVal,
7388
headers: {}
@@ -93,6 +108,7 @@ function dice_roll() {
93108
// 骰子双倍奖励
94109
function dice_double() {
95110
return new Promise((resolve, reject) => {
111+
const dice_double_urlVal = 'https://apiwz.midukanshu.com/wz/dice/doubleReward?' + signbodyVal
96112
const url = {
97113
url: dice_double_urlVal,
98114
headers: {}
@@ -118,6 +134,7 @@ function dice_double() {
118134
// 获取骰子次数
119135
function dice_addnum() {
120136
return new Promise((resolve, reject) => {
137+
const dice_addnum_urlVal = 'https://apiwz.midukanshu.com/wz/dice/addChangeNumByRewardVideo?' + signbodyVal
121138
const url = {
122139
url: dice_addnum_urlVal,
123140
headers: {}
@@ -143,6 +160,7 @@ function dice_addnum() {
143160
// 每日签到
144161
function signDay() {
145162
return new Promise((resolve, reject) => {
163+
const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2?' + signbodyVal
146164
const url = {
147165
url: signurlVal,
148166
headers: {}
@@ -168,6 +186,7 @@ function signDay() {
168186
// 签到视频奖励
169187
function signVideo() {
170188
return new Promise((resolve, reject) => {
189+
const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward?' + signbodyVal
171190
const url = {
172191
url: signVideourlVal,
173192
headers: {}
@@ -191,41 +210,44 @@ function signVideo() {
191210
}
192211

193212

194-
function showmsg() {
195-
let subTitle = ''
196-
let detail = ''
197-
// 签到信息
198-
if (signinfo.signDay && signinfo.signDay.code == 0) {
199-
if (signinfo.signDay.data) {
200-
const amount = signinfo.signDay.data.amount
201-
amount ? detail += `【签到奖励】获得${amount}💰\n` : detail += ``
202-
}
203-
} else subTitle += '签到:失败'
213+
function showmsg(name) {
214+
return new Promise((resolve, reject) => {
215+
let subTitle = name
216+
let detail = ''
217+
// 签到信息
218+
if (signinfo.signDay && signinfo.signDay.code == 0) {
219+
if (signinfo.signDay.data) {
220+
const amount = signinfo.signDay.data.amount
221+
amount ? detail += `【签到奖励】获得${amount}💰\n` : detail += ``
222+
}
223+
} else subTitle += '签到:失败'
204224

205-
if (signinfo.signVideo && signinfo.signVideo.code == 0) {
206-
const amount = signinfo.signVideo.data.amount
207-
amount ? detail += `【签到视频】获得${amount}💰\n` : detail += ``
208-
} else subTitle += '签到视频:失败'
225+
if (signinfo.signVideo && signinfo.signVideo.code == 0) {
226+
const amount = signinfo.signVideo.data.amount
227+
amount ? detail += `【签到视频】获得${amount}💰\n` : detail += ``
228+
} else subTitle += '签到视频:失败'
209229

210-
// 骰子信息
211-
// 次数
212-
if (signinfo.addnumList.length > 0) {
213-
detail += `【骰子次数】增加${signinfo.addnumList.length}次\n`
214-
} else {
215-
detail += `【骰子次数】无次数增加\n`
216-
}
217-
// 掷骰子
218-
if (signinfo.rollList.length > 0) {
219-
let i = 0
220-
for (const roll of signinfo.rollList) {
221-
i += 1
222-
roll.code == 0 ? detail += `【骰子奖励】第${i}次获得${roll.data.roll_coin}💰\n` : detail += ``
230+
// 骰子信息
231+
// 次数
232+
if (signinfo.addnumList.length > 0) {
233+
detail += `【骰子次数】增加${signinfo.addnumList.length}次\n`
234+
} else {
235+
detail += `【骰子次数】无次数增加\n`
223236
}
224-
} else {
225-
detail += `【骰子奖励】无次数掷骰子`
226-
}
227-
senku.msg(cookieName, subTitle, detail)
228-
senku.done()
237+
// 掷骰子
238+
if (signinfo.rollList.length > 0) {
239+
let i = 0
240+
for (const roll of signinfo.rollList) {
241+
i += 1
242+
roll.code == 0 ? detail += `【骰子奖励】第${i}次获得${roll.data.roll_coin}💰\n` : detail += ``
243+
}
244+
} else {
245+
detail += `【骰子奖励】无次数掷骰子`
246+
}
247+
senku.msg(cookieName, subTitle, detail)
248+
senku.done()
249+
resolve()
250+
})
229251
}
230252

231253
function init() {

0 commit comments

Comments
 (0)