From 58edd4129c081f286750d18bde02712567579d97 Mon Sep 17 00:00:00 2001 From: shanmite Date: Sun, 11 Sep 2022 17:24:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=A5=E5=8A=A8=E6=80=81=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E8=BD=AC=E5=8F=91=E5=88=86=E4=BA=AB(#189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed #189 --- lib/net/bili.js | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/lib/net/bili.js b/lib/net/bili.js index d6766f3..5774e17 100644 --- a/lib/net/bili.js +++ b/lib/net/bili.js @@ -919,24 +919,30 @@ const bili_client = { * @return {boolean} isError true */ async shareVideo(uid, aid) { - const responseText = await post({ - url: API.DYNAMIC_REPOST_SHARE, - contents: { - platform: "pc", - uid, - type: 8, - content: "分享视频", - repost_code: 20000, - rid: aid, - csrf_token: GlobalVar.get("csrf") - } - }); - if (/^{"code":0/.test(responseText)) { - log.info('转发视频', `成功转发视频(av${aid})`); - return false - } else { - log.error('转发视频', `转发失败\n${responseText}`); - return true + const + responseText = await post({ + url: API.DYNAMIC_REPOST_SHARE, + contents: { + platform: "pc", + uid, + type: 8, + content: "分享视频", + repost_code: 20000, + rid: aid, + csrf_token: GlobalVar.get("csrf") + } + }), + res = strToJson(responseText); + switch (res.code) { + case 0: + log.info('转发视频', `成功转发视频(av${aid})`); + return false + case 1101015: + log.warn('转发视频', `该动态不能转发分享(av${aid})`); + return false + default: + log.error('转发视频', `转发失败\n${responseText}`); + return true } }, /**