Skip to content

Commit 45a81d8

Browse files
author
GideonSenku
committed
添加[网易考拉]签到脚本
1 parent 8044fdc commit 45a81d8

7 files changed

Lines changed: 258 additions & 5 deletions

‎QuantumultX_AppStore_Local_Cookie.conf‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ hostname = daojia.jd.com, app.nio.com, wxprdapplet.gac-nio.com, maicai.api.ddxq.
7676
# 米游社
7777
^https:\/\/api-takumi.mihoyo.com\/apihub\/api\/getGameList url script-request-header chavyleung/mihoyo/mihoyo.cookie.js
7878

79+
7980
# 中国联通
8081
^https:\/\/act.10010.com\/SigninApp\/signin\/querySigninActivity.htm url script-request-header chavyleung/10010/10010.cookie.js
8182
^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign.do url script-request-header chavyleung/10010/10010.cookie.js
@@ -123,4 +124,7 @@ https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url sc
123124
^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ url script-request-body chavyleung/meituan/meituan.cookie.js
124125

125126
# 网易新闻
126-
^https:\/\/c\.m\.163\.com\/uc\/api\/sign\/v2\/commit url script-request-body chavyleung/neteasenews/neteasenews.cookie.js
127+
^https:\/\/c\.m\.163\.com\/uc\/api\/sign\/v2\/commit url script-request-body chavyleung/neteasenews/neteasenews.cookie.js
128+
129+
#网易考拉
130+
^https:\/\/m-bean\.kaola\.com/m/point/sign\.html url script-request-body chavyleung/wykl/wykl.cookie.js

‎QuantumultX_Local_Cookie.conf‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 本配置适用于: QuanX TestFlight v1.0.6-build195 及以后版本
22
# 如果你是商店版, 请使用: QuantumultX_AppStore_Local_Cookie.conf
33

4-
hostname = daojia.jd.com, app.nio.com, wxprdapplet.gac-nio.com, node.kg.qq.com, api.dushu.io, pm.m.fenqile.com, maicai.api.ddxq.mobi, group.baicizhan.com, api.everphoto.cn, i.meituan.com, promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, m.client.10010.com, act.10010.com, api-takumi.mihoyo.com, m.gdoil.cn, 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, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
4+
hostname = m-bean.kaola.com, daojia.jd.com, app.nio.com, wxprdapplet.gac-nio.com, node.kg.qq.com, api.dushu.io, pm.m.fenqile.com, maicai.api.ddxq.mobi, group.baicizhan.com, api.everphoto.cn, i.meituan.com, promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, m.client.10010.com, act.10010.com, api-takumi.mihoyo.com, m.gdoil.cn, 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, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
55

66
# 电信营业厅
77
^https:\/\/wapside.189.cn:9001\/api\/home\/homeInfo url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/10000/10000.cookie.js
@@ -120,4 +120,7 @@ https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url sc
120120
^https:\/\/wxprdapplet\.gac-nio\.com\/community\/userSignIn\/simpleAuth\/front\/v3\.1\.3\.5\/signV2$ url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/hycan/hycan.cookie.js
121121

122122
#京东到家
123-
^https:\/\/daojia.jd.com/client(.*?)functionId=signin(.*?)userSigninNew url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/jddj/jddj.cookie.js
123+
^https:\/\/daojia.jd.com/client(.*?)functionId=signin(.*?)userSigninNew url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/jddj/jddj.cookie.js
124+
125+
#网易考拉
126+
^https:\/\/m-bean\.kaola\.com/m/point/sign\.html url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/wykl/wykl.cookie.js

‎QuantumultX_Local_Task.conf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,6 @@
7676
#蔚来
7777
1 0 * * * chavyleung/nio/nio.js
7878
#京东到家
79-
1 0 * * * chavyleung/jddj/jddj.js
79+
1 0 * * * chavyleung/jddj/jddj.js
80+
#网易考拉
81+
1 0 * * * chavyleung/wyjl/wykl.js

‎QuantumultX_Remote_Task.conf‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,8 @@
154154

155155
# 海底捞
156156
#打开APP 然后手动签到 1 次
157-
12 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/haidilao/hdl.js
157+
12 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/haidilao/hdl.js
158+
159+
#网易考拉
160+
#打开 APP 手动签到一次: 访问下右下角 `我的考拉` > `领考拉豆` > `签到`
161+
1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/wykl/wykl.cookie.js

‎wykl/README.md‎

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

‎wykl/wykl.cookie.js‎

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

‎wykl/wykl.js‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
const cookieName = '网易考拉'
2+
const signurlKey = 'senku_signurl_wykl'
3+
const signheaderKey = 'senku_signheader_wykl'
4+
const signbodyKey = 'senku_signbody_wykl'
5+
const senku = init()
6+
const signurlVal = senku.getdata(signurlKey)
7+
const signheaderVal = senku.getdata(signheaderKey)
8+
const signBodyVal = senku.getdata(signbodyKey)
9+
10+
sign()
11+
12+
function sign() {
13+
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
14+
senku.post(url, (error, response, data) => {
15+
senku.log(`${cookieName}, data: ${data}`)
16+
const res = JSON.parse(data)
17+
let subTitle = ``
18+
let detail = ``
19+
if (res.retCode == 200) {
20+
subTitle = `签到结果: 成功`
21+
detail = `获得:${res.data.popupWindowInfo.frontRewardName},签到天数:${res.data.signCount}`
22+
} else if (res.retCode==401 || res.retCode==403 || res.code==401) {
23+
subTitle = `签到结果: 成功 (重复签到)`
24+
} else {
25+
subTitle = `签到结果: 失败`
26+
detail = `编码: ${res.code}, 说明: ${res.msg}`
27+
}
28+
senku.msg(cookieName, subTitle, detail)
29+
senku.done()
30+
})
31+
}
32+
33+
function init() {
34+
isSurge = () => {
35+
return undefined === this.$httpClient ? false : true
36+
}
37+
isQuanX = () => {
38+
return undefined === this.$task ? false : true
39+
}
40+
getdata = (key) => {
41+
if (isSurge()) return $persistentStore.read(key)
42+
if (isQuanX()) return $prefs.valueForKey(key)
43+
}
44+
setdata = (key, val) => {
45+
if (isSurge()) return $persistentStore.write(key, val)
46+
if (isQuanX()) return $prefs.setValueForKey(key, val)
47+
}
48+
msg = (title, subtitle, body) => {
49+
if (isSurge()) $notification.post(title, subtitle, body)
50+
if (isQuanX()) $notify(title, subtitle, body)
51+
}
52+
log = (message) => console.log(message)
53+
get = (url, cb) => {
54+
if (isSurge()) {
55+
$httpClient.get(url, cb)
56+
}
57+
if (isQuanX()) {
58+
url.method = 'GET'
59+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
60+
}
61+
}
62+
post = (url, cb) => {
63+
if (isSurge()) {
64+
$httpClient.post(url, cb)
65+
}
66+
if (isQuanX()) {
67+
url.method = 'POST'
68+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
69+
}
70+
}
71+
done = (value = {}) => {
72+
$done(value)
73+
}
74+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
75+
}

0 commit comments

Comments
 (0)