diff --git a/lib/v2/bilibili/cache.js b/lib/v2/bilibili/cache.js index be051d909766a8..1b2d6bf9936dfa 100644 --- a/lib/v2/bilibili/cache.js +++ b/lib/v2/bilibili/cache.js @@ -13,7 +13,11 @@ module.exports = { Referer: url, }, }); - return response.headers['set-cookie'].map((cookie) => cookie.split(';')[0]).join('; '); + const setCookies = response.headers['set-cookie']; + if (typeof setCookies === 'undefined') { + return ''; + } + return setCookies.map((cookie) => cookie.split(';')[0]).join('; '); }); }, getVerifyString: (ctx) => {