[什么值得买] 修复某些情况下获取不到CookieId的问题

This commit is contained in:
blackmatrix7 2022-09-21 10:25:25 +08:00
parent acd7fcd588
commit f6333009c2

View File

@ -34,8 +34,7 @@ async function getWebCookie() {
currentCookie = $.request.headers.cookie || $.request.headers.Cookie; currentCookie = $.request.headers.cookie || $.request.headers.Cookie;
if (currentCookie.length >= 200) { if (currentCookie.length >= 200) {
$.logger.info(`当前页面获取的Cookie: ${currentCookie}`); $.logger.info(`当前页面获取的Cookie: ${currentCookie}`);
const matchStr = currentCookie.match(/__ckguid=[^\s]*;/); const cookieId = currentCookie.match(/__ckguid=([^;]*)/ig);
const cookieId = matchStr !== null ? matchStr[0] : null;
$.logger.info(`当前页面获取的CookieId\n${cookieId}`); $.logger.info(`当前页面获取的CookieId\n${cookieId}`);
// 获取新的session_id // 获取新的session_id
if (cookieId) { if (cookieId) {