Skip to content

Commit b03d5ad

Browse files
committed
添加[字幕组]签到脚本
1 parent 9746776 commit b03d5ad

3 files changed

Lines changed: 222 additions & 0 deletions

File tree

‎zimuzu/README.md‎

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# 腾讯视频 (Surge & QuanX 二合一签到脚本)
2+
3+
> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可
4+
5+
> 需要 VIP 会员才能签到 (需要 VIP!需要 VIP!需要 VIP!)
6+
7+
## 配置 (Surge)
8+
9+
```properties
10+
[MITM]
11+
*.zmz2019.com
12+
13+
[Script]
14+
http-request ^https?:\/\/(www\.)?zmz2019\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.cookie.js
15+
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.js
16+
```
17+
18+
## 配置 (QuanX)
19+
20+
```properties
21+
[MITM]
22+
*.zmz2019.com
23+
24+
[rewrite_local]
25+
^https?:\/\/(www\.)?zmz2019\.com\/?.? url script-response-body zimuzu.cookie.js
26+
27+
[task_local]
28+
1 0 * * * zimuzu.js
29+
```
30+
31+
## 说明
32+
33+
1. 先在浏览器登录 `(先登录! 先登录! 先登录!)`
34+
2. 先把`*.zmz2019.com`加到`[MITM]`
35+
3. 再配置重写规则:
36+
- Surge: 把两条远程脚本放到`[Script]`
37+
- QuanX: 把`zimuzu.cookie.js`和`zimuzu.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关)
38+
4. 打开浏览器访问: http://www.zmz2019.com
39+
5. 系统提示: `获取Cookie: 成功`
40+
6. 最后就可以把第 1 条脚本注释掉了
41+
42+
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
43+
44+
> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次.
45+
46+
## 常见问题
47+
48+
1. 无法写入 Cookie
49+
50+
- 检查 Surge 系统通知权限放开了没
51+
- 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴)
52+
53+
2. 写入 Cookie 成功, 但签到不成功
54+
55+
- 看看是不是在登录前就写入 Cookie 了
56+
- 如果是,请确保在登录成功后,再尝试写入 Cookie
57+
58+
3. 为什么有时成功有时失败
59+
60+
- 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败)
61+
- 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学):
62+
63+
- `Surge`配置:
64+
65+
```properties
66+
# 没有什么是一顿饭解决不了的:
67+
cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次
68+
# 如果有,那就两顿:
69+
cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次
70+
# 实在不行,三顿也能接受:
71+
cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次
72+
73+
# 再粗暴点,直接:
74+
cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次
75+
```
76+
77+
- `QuanX`配置:
78+
79+
```properties
80+
[task_local]
81+
1 0 * * * xxx.js # 每天00:01执行一次
82+
2 0 * * * xxx.js # 每天00:02执行一次
83+
3 0 * * * xxx.js # 每天00:03执行一次
84+
85+
*/60 * * * * xxx.js # 每60分执行一次
86+
```
87+
88+
## 感谢
89+
90+
[@NobyDa](https://github.com/NobyDa)
91+
92+
[@lhie1](https://github.com/lhie1)
93+
94+
[@ConnersHua](https://github.com/ConnersHua)

‎zimuzu/zimuzu.cookie.js‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const cookieName = '字幕组'
2+
const cookieKey = 'chavy_cookie_zimuzu'
3+
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}`)
9+
}
10+
}
11+
function init() {
12+
isSurge = () => {
13+
return undefined === this.$httpClient ? false : true
14+
}
15+
isQuanX = () => {
16+
return undefined === this.$task ? false : true
17+
}
18+
getdata = (key) => {
19+
if (isSurge()) return $persistentStore.read(key)
20+
if (isQuanX()) return $prefs.valueForKey(key)
21+
}
22+
setdata = (key, val) => {
23+
if (isSurge()) return $persistentStore.write(key, val)
24+
if (isQuanX()) return $prefs.setValueForKey(key, val)
25+
}
26+
msg = (title, subtitle, body) => {
27+
if (isSurge()) $notification.post(title, subtitle, body)
28+
if (isQuanX()) $notify(title, subtitle, body)
29+
}
30+
log = (message) => console.log(message)
31+
get = (url, cb) => {
32+
if (isSurge()) {
33+
$httpClient.get(url, cb)
34+
}
35+
if (isQuanX()) {
36+
url.method = 'GET'
37+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
38+
}
39+
}
40+
post = (url, cb) => {
41+
if (isSurge()) {
42+
$httpClient.post(url, cb)
43+
}
44+
if (isQuanX()) {
45+
url.method = 'POST'
46+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
47+
}
48+
}
49+
done = (value = {}) => {
50+
$done(value)
51+
}
52+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
53+
}
54+
chavy.done()

‎zimuzu/zimuzu.js‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
const cookieName = '字幕组'
2+
const cookieKey = 'chavy_cookie_zimuzu'
3+
const chavy = init()
4+
const cookieVal = chavy.getdata(cookieKey)
5+
6+
sign()
7+
8+
function sign() {
9+
const timestamp = Date.parse(new Date())
10+
let url = { url: `http://www.zmz2019.com/user/login/getCurUserTopInfo`, headers: { Cookie: cookieVal } }
11+
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'
12+
13+
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} -> ${result.data.upgrade_day}`
23+
chavy.msg(title, subTitle, detail)
24+
} else {
25+
subTitle = '签到结果: 未知'
26+
chavy.msg(title, subTitle, detail)
27+
}
28+
})
29+
chavy.done()
30+
}
31+
32+
function init() {
33+
isSurge = () => {
34+
return undefined === this.$httpClient ? false : true
35+
}
36+
isQuanX = () => {
37+
return undefined === this.$task ? false : true
38+
}
39+
getdata = (key) => {
40+
if (isSurge()) return $persistentStore.read(key)
41+
if (isQuanX()) return $prefs.valueForKey(key)
42+
}
43+
setdata = (key, val) => {
44+
if (isSurge()) return $persistentStore.write(key, val)
45+
if (isQuanX()) return $prefs.setValueForKey(key, val)
46+
}
47+
msg = (title, subtitle, body) => {
48+
if (isSurge()) $notification.post(title, subtitle, body)
49+
if (isQuanX()) $notify(title, subtitle, body)
50+
}
51+
log = (message) => console.log(message)
52+
get = (url, cb) => {
53+
if (isSurge()) {
54+
$httpClient.get(url, cb)
55+
}
56+
if (isQuanX()) {
57+
url.method = 'GET'
58+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
59+
}
60+
}
61+
post = (url, cb) => {
62+
if (isSurge()) {
63+
$httpClient.post(url, cb)
64+
}
65+
if (isQuanX()) {
66+
url.method = 'POST'
67+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
68+
}
69+
}
70+
done = (value = {}) => {
71+
$done(value)
72+
}
73+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
74+
}

0 commit comments

Comments
 (0)