Skip to content

Commit 8cd0617

Browse files
committed
更新[字幕组]签到: 双端签到 (网页 & APP)
1 parent c9673d2 commit 8cd0617

4 files changed

Lines changed: 105 additions & 24 deletions

File tree

QuantumultX_Local_Cookie.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,7 @@ hostname = wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com
112112
# 字幕组
113113
# 189及以前版本
114114
# ^https?:\/\/(www\.)?rrys2019\.com\/?.? url script-response-body chavyleung/zimuzu/zimuzu.cookie.js
115+
# ^https?:\/\/h5.rrhuodong.com\/mobile\/mission\/pages\/task.html url script-response-body chavyleung/zimuzu/zimuzu.cookie.js
115116
# 190及以后版本
116117
^https?:\/\/(www\.)?rrys2019\.com\/?.? url script-request-header chavyleung/zimuzu/zimuzu.cookie.js
118+
^https?:\/\/h5.rrhuodong.com\/mobile\/mission\/pages\/task.html url script-request-header chavyleung/zimuzu/zimuzu.cookie.js

zimuzu/README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,60 @@
66
77
> 2020.1.28 适配人人影视新域名`http://www.rrys2019.com`
88
9+
> 2020.2.8 双端签到 (增加 APP 签到)
10+
911
## 配置 (Surge)
1012

1113
```properties
1214
[MITM]
13-
*.rrys2019.com
15+
*.rrys2019.com, h5.rrhuodong.com
1416

1517
[Script]
1618
http-request ^https?:\/\/(www\.)?rrys2019\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.cookie.js
19+
http-request ^https?:\/\/h5.rrhuodong.com\/mobile\/mission\/pages\/task.html script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.cookie.js
1720
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.js
1821
```
1922

2023
## 配置 (QuanX)
2124

2225
```properties
2326
[MITM]
24-
*.rrys2019.com
27+
*.rrys2019.com, h5.rrhuodong.com
2528

2629
[rewrite_local]
2730
# 189及以前版本
2831
^https?:\/\/(www\.)?rrys2019\.com\/?.? url script-response-body zimuzu.cookie.js
32+
^https?:\/\/h5.rrhuodong.com\/mobile\/mission\/pages\/task.html url script-response-body zimuzu.cookie.js
2933
# 190及以后版本
3034
^https?:\/\/(www\.)?rrys2019\.com\/?.? url script-request-header zimuzu.cookie.js
35+
^https?:\/\/h5.rrhuodong.com\/mobile\/mission\/pages\/task.html url script-request-header zimuzu.cookie.js
3136

3237
[task_local]
3338
1 0 * * * zimuzu.js
3439
```
3540

36-
## 说明
41+
## 说明 (网页)
3742

3843
1. 先在浏览器登录 `(先登录! 先登录! 先登录!)`
39-
2. 先把`*.rrys2019.com`加到`[MITM]`
44+
2. 先把`*.rrys2019.com, h5.rrhuodong.com`加到`[MITM]`
4045
3. 再配置重写规则:
4146
- Surge: 把两条远程脚本放到`[Script]`
4247
- QuanX: 把`zimuzu.cookie.js``zimuzu.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关)
4348
4. 打开浏览器访问: http://www.rrys2019.com
4449
5. 系统提示: `获取Cookie: 成功`
4550
6. 最后就可以把第 1 条脚本注释掉了
4651

52+
## 说明 (APP)
53+
54+
1. 先在浏览器登录 `(先登录! 先登录! 先登录!)`
55+
2. 先把`*.rrys2019.com, h5.rrhuodong.com`加到`[MITM]`
56+
3. 再配置重写规则:
57+
- Surge: 把两条远程脚本放到`[Script]`
58+
- QuanX: 把`zimuzu.cookie.js``zimuzu.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关)
59+
4. 打开 APP, `` > `任务墙`
60+
5. 系统提示: `获取Cookie: 成功`
61+
6. 最后就可以把第 1 条脚本注释掉了
62+
4763
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
4864
4965
> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次.

zimuzu/zimuzu.cookie.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
const cookieName = '字幕组'
22
const cookieKey = 'chavy_cookie_zimuzu'
3+
const cookieAppKey = 'chavy_cookie_zimuzu_app'
34
const chavy = init()
4-
const cookieVal = $request.headers['Cookie']
5-
if (cookieVal) {
6-
if (chavy.setdata(cookieVal, cookieKey)) {
7-
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
8-
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
5+
if ($request.headers.Host == 'h5.rrhuodong.com') {
6+
const cookieVal = $request.headers['Cookie']
7+
if (cookieVal) {
8+
if (chavy.setdata(cookieVal, cookieAppKey)) {
9+
chavy.msg(`${cookieName} (APP)`, '获取Cookie: 成功', '')
10+
chavy.log(`[${cookieName} (APP)] 获取Cookie: 成功, cookie: ${cookieAppKey}`)
11+
}
12+
}
13+
} else {
14+
const cookieVal = $request.headers['Cookie']
15+
if (cookieVal) {
16+
if (chavy.setdata(cookieVal, cookieKey)) {
17+
chavy.msg(`${cookieName} (网页)`, '获取Cookie: 成功', '')
18+
chavy.log(`[${cookieName} (网页)] 获取Cookie: 成功, cookie: ${cookieVal}`)
19+
}
920
}
1021
}
22+
1123
function init() {
1224
isSurge = () => {
1325
return undefined === this.$httpClient ? false : true

zimuzu/zimuzu.js

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,85 @@
11
const cookieName = '字幕组'
22
const cookieKey = 'chavy_cookie_zimuzu'
3+
const cookieAppKey = 'chavy_cookie_zimuzu_app'
34
const chavy = init()
45
const cookieVal = chavy.getdata(cookieKey)
6+
const cookieAppVal = chavy.getdata(cookieAppKey)
7+
const signinfo = {}
58

69
sign()
710

811
function sign() {
9-
const timestamp = Date.parse(new Date())
12+
signweb()
13+
signapp()
14+
check()
15+
}
16+
17+
function signweb() {
1018
let url = { url: `http://www.rrys2019.com/user/login/getCurUserTopInfo`, headers: { Cookie: cookieVal } }
1119
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
1220

1321
chavy.get(url, (error, response, data) => {
14-
chavy.log(`${cookieName}, data: ${data}`)
15-
let result = JSON.parse(data)
16-
const title = `${cookieName}`
17-
let subTitle = ''
18-
let detail = ''
19-
if (result.status == 1) {
20-
if (result.data.new_login) subTitle = '签到结果: 成功'
21-
else subTitle = '签到结果: 成功 (重复签到)'
22-
detail = `人人钻: ${result.data.userinfo.point}, 登录天数: ${result.data.usercount.cont_login}`
23-
chavy.msg(title, subTitle, detail)
24-
} else {
25-
subTitle = '签到结果: 未知'
26-
chavy.msg(title, subTitle, detail)
27-
}
22+
chavy.log(`${cookieName}, signweb - data: ${data}`)
23+
signinfo.web = JSON.parse(data)
24+
})
25+
}
26+
27+
function signapp() {
28+
let url = { url: `http://h5.rrhuodong.com/index.php?g=api/mission&m=clock&a=store&id=2`, headers: { Cookie: cookieAppVal } }
29+
url.headers['Accept'] = `application/json, text/plain, */*`
30+
url.headers['Accept-Encoding'] = `gzip, deflate`
31+
url.headers['Accept-Language'] = `zh-cn`
32+
url.headers['Connection'] = `close`
33+
url.headers['Host'] = `h5.rrhuodong.com`
34+
url.headers['Referer'] = `http://h5.rrhuodong.com/mobile/mission/pages/task.html`
35+
url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
36+
37+
chavy.get(url, (error, response, data) => {
38+
chavy.log(`${cookieName}, signapp - data: ${data}`)
39+
signinfo.app = JSON.parse(data)
2840
})
41+
}
42+
43+
function getinfo() {
44+
const title = `${cookieName}`
45+
let subTitle = `网页: `
46+
let detail = ''
47+
48+
// web
49+
if (signinfo.web.status == 1) {
50+
if (signinfo.web.data.new_login) subTitle += '成功'
51+
else subTitle += '成功 (重复)'
52+
detail = `人人钻: ${signinfo.web.data.userinfo.point}, 登录天数: ${signinfo.web.data.usercount.cont_login}`
53+
} else if (signinfo.web.status == 4001) {
54+
subTitle += '未登录'
55+
} else {
56+
subTitle += '失败'
57+
}
58+
59+
// app
60+
subTitle += `; APP: `
61+
if (signinfo.app.status == 1) subTitle += '成功'
62+
else if (signinfo.app.status == 4005) subTitle += '成功 (重复)'
63+
else if (signinfo.app.status == 1021) subTitle += '未登录'
64+
else subTitle += '失败'
65+
66+
chavy.msg(title, subTitle, detail)
2967
chavy.done()
3068
}
3169

70+
function check(checkms = 0) {
71+
if (signinfo.web && signinfo.app) {
72+
getinfo()
73+
} else {
74+
if (checkms > 5000) {
75+
chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``)
76+
chavy.done()
77+
} else {
78+
setTimeout(() => check(checkms + 100), 100)
79+
}
80+
}
81+
}
82+
3283
function init() {
3384
isSurge = () => {
3485
return undefined === this.$httpClient ? false : true

0 commit comments

Comments
 (0)