Skip to content

Commit 60ff24b

Browse files
committed
添加[猫咪音乐网]签到
1 parent b9bf533 commit 60ff24b

5 files changed

Lines changed: 226 additions & 2 deletions

File tree

‎QuantumultX_Local_Cookie.conf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hostname = act.10010.com, api-takumi.mihoyo.com, gdws.nsenz.com, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
1+
hostname = www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, gdws.nsenz.com, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
22

33
# 电信营业厅
44
# 190及以后版本
@@ -134,3 +134,5 @@ hostname = act.10010.com, api-takumi.mihoyo.com, gdws.nsenz.com, credits.bz.mgtv
134134
^https:\/\/act.10010.com\/SigninApp\/signin\/querySigninActivity.htm url script-request-header chavyleung/10010/10010.cookie.js
135135
^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign.do url script-request-header chavyleung/10010/10010.cookie.js
136136

137+
# 猫咪音乐网
138+
https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url script-request-header chavyleung/maomicd/maomicd.cookie.js

‎QuantumultX_Local_Task.conf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@
4747
# 米游社
4848
2 0 * * * chavyleung/mihoyo/mihoyo.js
4949
# 中国联通
50-
9 0 * * * chavyleung/10010/10010.js
50+
9 0 * * * chavyleung/10010/10010.js
51+
# 猫咪音乐网
52+
2 0 * * * chavyleung/maomicd/maomicd.js

‎maomicd/README.md‎

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

‎maomicd/maomicd.cookie.js‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
const cookieName = '猫咪音乐网'
2+
const signurlKey = 'chavy_signurl_maomicd'
3+
const signheaderKey = 'chavy_signheader_maomicd'
4+
const chavy = init()
5+
6+
if ($request && $request.method != 'OPTIONS') {
7+
const signurlVal = $request.url
8+
const signheaderVal = JSON.stringify($request.headers)
9+
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
10+
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
11+
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
12+
}
13+
14+
function init() {
15+
isSurge = () => {
16+
return undefined === this.$httpClient ? false : true
17+
}
18+
isQuanX = () => {
19+
return undefined === this.$task ? false : true
20+
}
21+
getdata = (key) => {
22+
if (isSurge()) return $persistentStore.read(key)
23+
if (isQuanX()) return $prefs.valueForKey(key)
24+
}
25+
setdata = (key, val) => {
26+
if (isSurge()) return $persistentStore.write(key, val)
27+
if (isQuanX()) return $prefs.setValueForKey(key, val)
28+
}
29+
msg = (title, subtitle, body) => {
30+
if (isSurge()) $notification.post(title, subtitle, body)
31+
if (isQuanX()) $notify(title, subtitle, body)
32+
}
33+
log = (message) => console.log(message)
34+
get = (url, cb) => {
35+
if (isSurge()) {
36+
$httpClient.get(url, cb)
37+
}
38+
if (isQuanX()) {
39+
url.method = 'GET'
40+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
41+
}
42+
}
43+
post = (url, cb) => {
44+
if (isSurge()) {
45+
$httpClient.post(url, cb)
46+
}
47+
if (isQuanX()) {
48+
url.method = 'POST'
49+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
50+
}
51+
}
52+
done = (value = {}) => {
53+
$done(value)
54+
}
55+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
56+
}
57+
chavy.done()

‎maomicd/maomicd.js‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
const cookieName = '猫咪音乐网'
2+
const signurlKey = 'chavy_signurl_maomicd'
3+
const signheaderKey = 'chavy_signheader_maomicd'
4+
const chavy = init()
5+
const signurlVal = chavy.getdata(signurlKey)
6+
const signheaderVal = chavy.getdata(signheaderKey)
7+
8+
sign()
9+
10+
function sign() {
11+
const url = { url: signurlVal, headers: JSON.parse(signheaderVal) }
12+
chavy.get(url, (error, response, data) => {
13+
chavy.log(`${cookieName}, data: ${data}`)
14+
let subTitle = ``
15+
let detail = ``
16+
let result = data.match(/<root>(<!\[CDATA\[(.*?)\]\]>)<\/root>/)
17+
if (result) {
18+
result = result[2]
19+
if (result == '') subTitle = `签到结果: 成功`
20+
if (result.indexOf('今日已签') >= 0) subTitle = `签到结果: 成功 (重复签到)`
21+
else (subTitle = `签到结果: 未知`), (detail = `说明: ${result}`)
22+
} else {
23+
subTitle = `签到结果: 失败`
24+
}
25+
chavy.msg(cookieName, subTitle, detail)
26+
chavy.done()
27+
})
28+
}
29+
30+
function init() {
31+
isSurge = () => {
32+
return undefined === this.$httpClient ? false : true
33+
}
34+
isQuanX = () => {
35+
return undefined === this.$task ? false : true
36+
}
37+
getdata = (key) => {
38+
if (isSurge()) return $persistentStore.read(key)
39+
if (isQuanX()) return $prefs.valueForKey(key)
40+
}
41+
setdata = (key, val) => {
42+
if (isSurge()) return $persistentStore.write(key, val)
43+
if (isQuanX()) return $prefs.setValueForKey(key, val)
44+
}
45+
msg = (title, subtitle, body) => {
46+
if (isSurge()) $notification.post(title, subtitle, body)
47+
if (isQuanX()) $notify(title, subtitle, body)
48+
}
49+
log = (message) => console.log(message)
50+
get = (url, cb) => {
51+
if (isSurge()) {
52+
$httpClient.get(url, cb)
53+
}
54+
if (isQuanX()) {
55+
url.method = 'GET'
56+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
57+
}
58+
}
59+
post = (url, cb) => {
60+
if (isSurge()) {
61+
$httpClient.post(url, cb)
62+
}
63+
if (isQuanX()) {
64+
url.method = 'POST'
65+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
66+
}
67+
}
68+
done = (value = {}) => {
69+
$done(value)
70+
}
71+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
72+
}

0 commit comments

Comments
 (0)