Skip to content

Commit 1d5776b

Browse files
committed
添加[美团外卖]签到
1 parent a577adc commit 1d5776b

File tree

5 files changed

+273
-3
lines changed

5 files changed

+273
-3
lines changed

QuantumultX_Local_Cookie.conf

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hostname = wx.10086.cn, 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, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
1+
hostname = promotion.waimai.meituan.com, wx.10086.cn, 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, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
22

33
# 电信营业厅
44
# 190及以后版本
@@ -137,4 +137,8 @@ hostname = wx.10086.cn, www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, g
137137
^http:\/\/wx.10086.cn\/website\/taskCenter\/sign\? url script-request-header chavyleung/10086/10086.cookie.js
138138

139139
# 猫咪音乐网
140-
https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url script-request-header chavyleung/maomicd/maomicd.cookie.js
140+
https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url script-request-header chavyleung/maomicd/maomicd.cookie.js
141+
142+
# 美团外卖
143+
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/entry url script-request-header chavyleung/wmmeituan/wmmeituan.cookie.js
144+
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-header chavyleung/wmmeituan/wmmeituan.cookie.js

QuantumultX_Local_Task.conf

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@
5151
# 猫咪音乐网
5252
2 0 * * * chavyleung/maomicd/maomicd.js
5353
# 中国移动
54-
7 0 * * * chavyleung/10086/10086.js
54+
7 0 * * * chavyleung/10086/10086.js
55+
# 美团外卖
56+
8 0 * * * chavyleung/wmmeituan/wmmeituan.js

wmmeituan/README.md

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

wmmeituan/wmmeituan.cookie.js

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
const cookieName = '美团外卖'
2+
const tokenurlKey = 'chavy_tokenurl_wmmeituan'
3+
const tokenheaderKey = 'chavy_tokenheader_wmmeituan'
4+
const signurlKey = 'chavy_signurl_wmmeituan'
5+
const signheaderKey = 'chavy_signheader_wmmeituan'
6+
const signbodyKey = 'chavy_signbody_wmmeituan'
7+
const chavy = init()
8+
9+
const requrl = $request.url
10+
const reqRef = $request.headers.Referer
11+
if ($request && $request.method != 'OPTIONS' && requrl.match(/playcenter\/signIn\/entry/)) {
12+
const tokenurlVal = requrl
13+
const tokenheaderVal = JSON.stringify($request.headers)
14+
if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey)
15+
if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey)
16+
title = chavy.msg(cookieName, `获取刷新链接: 成功`, ``)
17+
} else if ($request && $request.method != 'OPTIONS' && requrl.match(/playcenter\/signIn\/doaction/)) {
18+
const signurlVal = requrl
19+
const signheaderVal = JSON.stringify($request.headers)
20+
const signbodyVal = $request.body
21+
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
22+
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
23+
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
24+
else {
25+
const tokenurlVal = chavy.getdata(tokenurlKey)
26+
const body = {}
27+
body.activityViewId = tokenurlVal.match(/activityViewId=(.*?)(&|$)/)[1]
28+
body.lat = tokenurlVal.match(/lat=(.*?)(&|$)/)[1]
29+
body.lng = tokenurlVal.match(/lng=(.*?)(&|$)/)[1]
30+
body.checkLogin = true
31+
body.appType = 3
32+
body.deviceType = 2
33+
chavy.setdata(JSON.stringify(body), signbodyKey)
34+
}
35+
title = chavy.msg(cookieName, `获取Cookie: 成功`, ``)
36+
}
37+
38+
function init() {
39+
isSurge = () => {
40+
return undefined === this.$httpClient ? false : true
41+
}
42+
isQuanX = () => {
43+
return undefined === this.$task ? false : true
44+
}
45+
getdata = (key) => {
46+
if (isSurge()) return $persistentStore.read(key)
47+
if (isQuanX()) return $prefs.valueForKey(key)
48+
}
49+
setdata = (key, val) => {
50+
if (isSurge()) return $persistentStore.write(key, val)
51+
if (isQuanX()) return $prefs.setValueForKey(key, val)
52+
}
53+
msg = (title, subtitle, body) => {
54+
if (isSurge()) $notification.post(title, subtitle, body)
55+
if (isQuanX()) $notify(title, subtitle, body)
56+
}
57+
log = (message) => console.log(message)
58+
get = (url, cb) => {
59+
if (isSurge()) {
60+
$httpClient.get(url, cb)
61+
}
62+
if (isQuanX()) {
63+
url.method = 'GET'
64+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
65+
}
66+
}
67+
post = (url, cb) => {
68+
if (isSurge()) {
69+
$httpClient.post(url, cb)
70+
}
71+
if (isQuanX()) {
72+
url.method = 'POST'
73+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
74+
}
75+
}
76+
done = (value = {}) => {
77+
$done(value)
78+
}
79+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
80+
}
81+
chavy.done()

wmmeituan/wmmeituan.js

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
const cookieName = '美团外卖'
2+
const tokenurlKey = 'chavy_tokenurl_wmmeituan'
3+
const tokenheaderKey = 'chavy_tokenheader_wmmeituan'
4+
const signurlKey = 'chavy_signurl_wmmeituan'
5+
const signheaderKey = 'chavy_signheader_wmmeituan'
6+
const signbodyKey = 'chavy_signbody_wmmeituan'
7+
const chavy = init()
8+
const tokenurlVal = chavy.getdata(tokenurlKey)
9+
const tokenheaderVal = chavy.getdata(tokenheaderKey)
10+
const signurlVal = chavy.getdata(signurlKey)
11+
const signheaderVal = chavy.getdata(signheaderKey)
12+
const signBodyVal = chavy.getdata(signbodyKey)
13+
14+
sign()
15+
16+
function sign() {
17+
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
18+
chavy.post(url, (error, response, data) => {
19+
chavy.log(`${cookieName}, data: ${data}`)
20+
const result = JSON.parse(data)
21+
let subTitle = ``
22+
let detail = ``
23+
if (result.code == 0 && result.subcode == 0) {
24+
subTitle = `签到结果: 成功`
25+
detail = `说明: ${result.msg}`
26+
} else if (result.code == 1 && result.subcode == 3) {
27+
subTitle = `签到结果: 成功 (重复签到)`
28+
detail = `说明: ${result.msg}`
29+
} else {
30+
subTitle = `签到结果: 失败`
31+
detail = `编码: ${result.code}-${result.subcode}, 说明: ${result.msg}`
32+
}
33+
chavy.msg(cookieName, subTitle, detail)
34+
chavy.done()
35+
})
36+
}
37+
38+
function init() {
39+
isSurge = () => {
40+
return undefined === this.$httpClient ? false : true
41+
}
42+
isQuanX = () => {
43+
return undefined === this.$task ? false : true
44+
}
45+
getdata = (key) => {
46+
if (isSurge()) return $persistentStore.read(key)
47+
if (isQuanX()) return $prefs.valueForKey(key)
48+
}
49+
setdata = (key, val) => {
50+
if (isSurge()) return $persistentStore.write(key, val)
51+
if (isQuanX()) return $prefs.setValueForKey(key, val)
52+
}
53+
msg = (title, subtitle, body) => {
54+
if (isSurge()) $notification.post(title, subtitle, body)
55+
if (isQuanX()) $notify(title, subtitle, body)
56+
}
57+
log = (message) => console.log(message)
58+
get = (url, cb) => {
59+
if (isSurge()) {
60+
$httpClient.get(url, cb)
61+
}
62+
if (isQuanX()) {
63+
url.method = 'GET'
64+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
65+
}
66+
}
67+
post = (url, cb) => {
68+
if (isSurge()) {
69+
$httpClient.post(url, cb)
70+
}
71+
if (isQuanX()) {
72+
url.method = 'POST'
73+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
74+
}
75+
}
76+
done = (value = {}) => {
77+
$done(value)
78+
}
79+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
80+
}

0 commit comments

Comments
 (0)