electron内监控目标网站cookie的变化,查找指定的cookie

let cookieInstance = win.webContents.session.cookies;
cookieInstance.on('changed', (e, cookie, cause, removed) => {
    let obj = { e, cookie, cause, removed }
    console.log(obj);
});
cookieInstance.get({ domain: 'dayu.com' }, (error, cookies) => {
    let tarCookie = cookies.find(v => v.name == "USER_TMP")
});

代码如上↑

posted @ 2019-09-06 09:17  liulun  阅读(1907)  评论(0编辑  收藏  举报