mirror of
https://github.com/Giu-zhao/ios_rule_script
synced 2024-11-22 08:28:25 +08:00
适配饿了么最新接口
This commit is contained in:
parent
7030a2146e
commit
8b54436514
@ -1,5 +1,5 @@
|
||||
const scriptName = '饿了么';
|
||||
const getCookieRegex = /^https?:\/\/h5\.ele\.me\/restapi\/svip_biz\/v1\/supervip\/queryMissionCollect\?longitude=([^&]*).*latitude=([^&]*)/;
|
||||
const getCookieRegex = /^https?:\/\/h5\.ele\.me\/restapi\/biz\.svip_scene\/svip\/engine\/queryTrafficSupply\?.*longitude=([^&]*).*latitude=([^&]*)/;
|
||||
const elemeCookieKey = 'eleme_app_cookie';
|
||||
const elemeLongitudeKey = 'eleme_app_longitude';
|
||||
const elemeLatitudeKey = 'eleme_app_latitude';
|
||||
|
@ -1,6 +1,6 @@
|
||||
# 饿了么每日自动领取任务及吃货豆
|
||||
|
||||
http-request ^https?:\/\/h5\.ele\.me\/restapi\/svip_biz\/v1\/supervip\/queryMissionCollect\??longitude=([^&]*).*latitude=([^&]*) requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js,tag=饿了么_获取cookie
|
||||
http-request ^https?:\/\/h5\.ele\.me\/restapi\/biz\.svip_scene\/svip\/engine\/queryTrafficSupply requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js,tag=饿了么_获取cookie
|
||||
cron "10 00 * * *" script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js,timeout=60,tag=饿了么_领取吃货豆
|
||||
cron "00 10 * * *" script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_mission.js,timeout=60,tag=饿了么_领取会员任务
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# 饿了么每日自动领取任务及吃货豆
|
||||
|
||||
^https?:\/\/h5\.ele\.me\/restapi\/svip_biz\/v1\/supervip\/queryMissionCollect\??longitude=([^&]*).*latitude=([^&]*) url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js
|
||||
^https?:\/\/h5\.ele\.me\/restapi\/biz\.svip_scene\/svip\/engine\/queryTrafficSupply url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js
|
||||
|
||||
hostname = h5.ele.me
|
@ -5,7 +5,7 @@
|
||||
[Script]
|
||||
饿了么_领取吃货豆 = type=cron,cronexp=10 00 * * *,timeout=60,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js
|
||||
饿了么_领取任务 = type=cron,cronexp=00 10 * * *,timeout=60,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_mission.js
|
||||
饿了么_获取cookie = type=http-request,pattern=^https?:\/\/h5\.ele\.me\/restapi\/svip_biz\/v1\/supervip\/queryMissionCollect\??longitude=([^&]*).*latitude=([^&]*),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js
|
||||
饿了么_获取cookie = type=http-request,pattern=^https?:\/\/h5\.ele\.me\/restapi\/biz\.svip_scene\/svip\/engine\/queryTrafficSupply,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/eleme/eleme_daily.js
|
||||
|
||||
[MITM]
|
||||
hostname = %APPEND% h5.ele.me
|
@ -1,5 +1,4 @@
|
||||
const scriptName = "饿了么";
|
||||
const getCookieRegex = /^https?:\/\/h5\.ele\.me\/restapi\/svip_biz\/v1\/supervip\/queryMissionCollect\?longitude=([^&]*).*latitude=([^&]*)/;
|
||||
const elemeCookieKey = "eleme_app_cookie";
|
||||
const elemeLongitudeKey = "eleme_app_longitude";
|
||||
const elemeLatitudeKey = "eleme_app_latitude";
|
||||
@ -10,30 +9,6 @@ const requiredOrderAmount = 4; // 需要完成订单数量小于等于此数的
|
||||
let magicJS = MagicJS(scriptName, "INFO");
|
||||
magicJS.unifiedPushUrl = magicJS.read("eleme_app_unified_push_url") || magicJS.read("magicjs_unified_push_url");
|
||||
|
||||
function GetCookie() {
|
||||
try {
|
||||
let cookie = magicJS.request.headers.Cookie;
|
||||
let arr = magicJS.request.url.match(getCookieRegex);
|
||||
let longitude = arr[1];
|
||||
let latitude = arr[2];
|
||||
let hisCookie = magicJS.read(elemeCookieKey);
|
||||
magicJS.write(elemeLongitudeKey, longitude);
|
||||
magicJS.write(elemeLatitudeKey, latitude);
|
||||
let compareCookie2 = !!cookie ? /cookie2=([a-zA-Z0-9]*)/.exec(cookie)[1] : null;
|
||||
let compareHisCookie2 = !!hisCookie ? /cookie2=([a-zA-Z0-9]*)/.exec(hisCookie)[1] : null;
|
||||
if (!!!hisCookie || compareCookie2 !== compareHisCookie2) {
|
||||
magicJS.write(elemeCookieKey, cookie);
|
||||
magicJS.logInfo(`旧的Cookie:${hisCookie}\n新的Cookie:${cookie}\nCookie不同,写入新的Cookie成功!`);
|
||||
magicJS.notify("Cookie写入成功!!");
|
||||
} else {
|
||||
magicJS.logInfo("Cookie没有变化,无需更新");
|
||||
}
|
||||
} catch (err) {
|
||||
magicJS.notify("获取Cookie出现异常,请查阅日志。");
|
||||
magicJS.logError(`获取Cookie出现执行异常,异常信息:${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取超级会员任务列表
|
||||
function GetSuperVipMissions(cookie, longitude, latitude) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -109,7 +84,7 @@ function AcceptMission(cookie, longitude, latitude, mission_id) {
|
||||
"User-Agent": "Rajax/1 Apple/iPhone10,3 iOS/14.5.1 Eleme/9.8.5",
|
||||
"f-pTraceId": "WVNet_WV_1-1-40",
|
||||
"f-refer": "wv_h5",
|
||||
"x-shard": "loc=121.52699279785156,31.2293643951416"
|
||||
"x-shard": "loc=121.52699279785156,31.2293643951416",
|
||||
},
|
||||
body: {
|
||||
longitude: longitude,
|
||||
@ -140,11 +115,6 @@ function AcceptMission(cookie, longitude, latitude, mission_id) {
|
||||
}
|
||||
|
||||
(async () => {
|
||||
if (magicJS.isRequest) {
|
||||
if (getCookieRegex.test(magicJS.request.url) && magicJS.request.method == "GET") {
|
||||
GetCookie();
|
||||
}
|
||||
} else {
|
||||
let subTitle = "";
|
||||
let content = "";
|
||||
let cookie = magicJS.read(elemeCookieKey);
|
||||
@ -180,7 +150,6 @@ function AcceptMission(cookie, longitude, latitude, mission_id) {
|
||||
}
|
||||
// 通知
|
||||
magicJS.notify(scriptName, subTitle, content);
|
||||
}
|
||||
magicJS.done();
|
||||
})();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user