From 022433975e25cbdbbeda98f27ae990a349c8a9e4 Mon Sep 17 00:00:00 2001 From: Nano Date: Sat, 3 Oct 2020 07:00:34 +0800 Subject: [PATCH] fix: bilibili Cookie overdue (#5783) --- lib/routes/bilibili/followings_article.js | 5 ++++- lib/routes/bilibili/followings_video.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/routes/bilibili/followings_article.js b/lib/routes/bilibili/followings_article.js index 40cc6e125..478e42371 100644 --- a/lib/routes/bilibili/followings_article.js +++ b/lib/routes/bilibili/followings_article.js @@ -9,7 +9,7 @@ module.exports = async (ctx) => { const cookie = config.bilibili.cookies[uid]; if (cookie === undefined) { - throw Error('缺少对应uid的b站用户登录后的Cookie值'); + throw Error('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值'); } const response = await got({ @@ -20,6 +20,9 @@ module.exports = async (ctx) => { Cookie: cookie, }, }); + if (response.data.code === -6) { + throw Error('对应 uid 的 Bilibili 用户的 Cookie 已过期'); + } const cards = response.data.data.cards; const out = await Promise.all( diff --git a/lib/routes/bilibili/followings_video.js b/lib/routes/bilibili/followings_video.js index bb3dc020c..1ae21f14a 100644 --- a/lib/routes/bilibili/followings_video.js +++ b/lib/routes/bilibili/followings_video.js @@ -10,7 +10,7 @@ module.exports = async (ctx) => { const cookie = config.bilibili.cookies[uid]; if (cookie === undefined) { - throw Error('缺少对应uid的b站用户登录后的Cookie值'); + throw Error('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值'); } const response = await got({ @@ -21,6 +21,9 @@ module.exports = async (ctx) => { Cookie: cookie, }, }); + if (response.data.code === -6) { + throw Error('对应 uid 的 Bilibili 用户的 Cookie 已过期'); + } const cards = response.data.data.cards; const out = await Promise.all(