适配新版贴吧获取Cookie接口 close #317

This commit is contained in:
blackmatrix7 2021-04-23 17:39:56 +08:00
parent 9f8fd6f3e9
commit 92ef325f21
4 changed files with 9 additions and 5 deletions

View File

@ -7,7 +7,8 @@ const batchSize = 20;
const retries = 5; // 签到失败重试次数 const retries = 5; // 签到失败重试次数
const interval = 2000; // 每次重试间隔 const interval = 2000; // 每次重试间隔
const tiebaCookieKey = "tieba_checkin_cookie"; const tiebaCookieKey = "tieba_checkin_cookie";
const tiebeGetCookieRegex = /https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login/; const tiebeGetCookieRegex = /https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login/;
const tiebeNewVersionGetCookieRegex = /^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig/;
let magicJS = MagicJS(scirptName, "INFO"); let magicJS = MagicJS(scirptName, "INFO");
magicJS.unifiedPushUrl = magicJS.read("tieba_unified_push_url") || magicJS.read("magicjs_unified_push_url"); magicJS.unifiedPushUrl = magicJS.read("tieba_unified_push_url") || magicJS.read("magicjs_unified_push_url");
@ -108,7 +109,7 @@ function TiebaCheckIn(cookie, tbs, tieba) {
} }
(async () => { (async () => {
if (magicJS.isRequest && tiebeGetCookieRegex.test(magicJS.request.url)) { if (magicJS.isRequest && (tiebeGetCookieRegex.test(magicJS.request.url) || tiebeNewVersionGetCookieRegex.test(magicJS.request.url))) {
let cookie = magicJS.request.headers.Cookie; let cookie = magicJS.request.headers.Cookie;
let hisCookie = magicJS.read(tiebaCookieKey); let hisCookie = magicJS.read(tiebaCookieKey);
magicJS.logDebug(`当前贴吧Cookie\n${cookie}\n历史贴吧Cookie\n${hisCookie}`); magicJS.logDebug(`当前贴吧Cookie\n${cookie}\n历史贴吧Cookie\n${hisCookie}`);

View File

@ -1,6 +1,7 @@
# 百度贴吧签到 # 百度贴吧签到
http-request ^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,tag=贴吧_获取Cookie http-request ^https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,tag=贴吧_获取Cookie
http-request ^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,tag=贴吧_获取新版Cookie
cron "30 0 * * *" script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,timeout=60,tag=贴吧_每日签到 cron "30 0 * * *" script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js,timeout=60,tag=贴吧_每日签到
hostname = c.tieba.baidu.com hostname = c.tieba.baidu.com

View File

@ -1,5 +1,6 @@
# 百度贴吧每日自动签到 # 百度贴吧每日自动签到
^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js ^https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js
^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig url script-request-header https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js
hostname = c.tieba.baidu.com hostname = c.tieba.baidu.com

View File

@ -4,7 +4,8 @@
[Script] [Script]
贴吧_每日签到 = type=cron,cronexp=30 0 * * *,timeout=60,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js 贴吧_每日签到 = type=cron,cronexp=30 0 * * *,timeout=60,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js
贴吧_获取cookie = type=http-request,pattern=^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/login,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js 贴吧_获取cookie = type=http-request,pattern=^https?:\/\/(c\.tieba\.baidu\.com|180\.97\.\d+\.\d+)\/c\/s\/login,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js
贴吧_获取新版cookie = type=http-request,pattern=^https?:\/\/c\.tieba\.baidu\.com\/c\/s\/channelIconConfig,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/tieba/tieba_checkin.js
[MITM] [MITM]
hostname = %APPEND% c.tieba.baidu.com hostname = %APPEND% c.tieba.baidu.com