解决 网易云 cookie 添加 .music.163.com 域设置。

This commit is contained in:
lengyx
2018-01-14 00:23:20 +08:00
parent 21e33a8a9f
commit 9401f7547d
3 changed files with 11 additions and 8 deletions
+7 -1
View File
@@ -67,7 +67,13 @@ function createWebAPIRequest(
if (error) {
errorcallback(error);
} else {
callback(body, res.headers["set-cookie"]);
//解决 网易云 cookie 添加 .music.163.com 域设置。
//如: Domain=.music.163.com
let cookie = res.headers["set-cookie"];
if (Array.isArray(cookie)) {
cookie = cookie.map(x => x.replace(/.music.163.com/g, "")).sort((a, b) => a.length - b.length)
}
callback(body, cookie);
}
});
}