大贤者
精华
|
战斗力 鹅
|
回帖 0
注册时间 2007-6-16
|
楼主 |
发表于 2022-10-22 23:23
|
显示全部楼层
本帖最后由 sosai 于 2022-10-22 23:54 编辑
直接复制进油猴显示代码错误,我稍微改了一下,但输出是
改后的代码是
const cookiedomain = 'saraba1st.com';
var cookies = await GM.cookie.list({domain:cookiedomain}).then((cookies)=>{
console.log(cookies);
});
var str1= new String();
for (let obj in cookies) {
str1 += obj + "=" + cookies[obj] + ";" ;
}
console.log(str1);
saveData(JSON.stringify(str1));
使用2楼的代码输出的是
[{"domain":"saraba1st.com","httpOnly":false,"secure":true,"name":"XSRF-TOKEN","path":"/","sameSite":"unspecified","value":"111","session":true,"hostOnly":true},
{"domain":".saraba1st.com","httpOnly":false,"secure":false,"name":"login_sid_t","path":"/","sameSite":"unspecified","value":"222","session":true,"hostOnly":false},
{"domain":".saraba1st.com","httpOnly":false,"secure":false,"name":"cross_origin_proto","path":"/","sameSite":"unspecified","value":"SSL","session":true,"hostOnly":false},
{"expirationDate":*************,"domain":".saraba1st.com","httpOnly":true,"secure":true,"name":"SCF","path":"/","sameSite":"no_restriction","value":"333","session":false,"hostOnly":false},
{"domain":".saraba1st.com","httpOnly":true,"secure":true,"name":"SUB","path":"/","sameSite":"no_restriction","value":"444","session":true,"hostOnly":false},
{"expirationDate":*************,"domain":".saraba1st.com","httpOnly":true,"secure":true,"name":"PC_TOKEN","path":"/","sameSite":"unspecified","value":"555","session":false,"hostOnly":false},
我需要的是
XSRF-TOKEN=111;login_sid_t=222;cross_origin_proto=SSL;SCF=333;SUB=444;PC_TOKEN=555
猜了下你的代码,应该是历遍数组,提取后重组的意思?
不知哪里执行错误,出不来想要的结果
|
|