From 771d9d63560918b90f5a42e846945ba24e6f714b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=99=8E=E6=95=85=E6=B4=9E?= <55782476+TigerCubDen@users.noreply.github.com> Date: Sun, 14 Feb 2021 02:18:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=93=94=E5=93=A9=E5=93=94=E5=93=A9-?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=85=B3=E6=B3=A8=E5=8A=A8=E6=80=81=20(#6873?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add files via upload * Add files via upload * Create .env * Update followings_dynamic.js * Update followings_dynamic.js * Update followings_dynamic.js * Update social-media.md * Delete .env * Update social-media.md * Update followings_dynamic.js * Update followings_dynamic.js * Add files via upload 添加作者信息 * [CodeFactor] Apply fixes to commit 57935d0 [ci skip] [skip ci] * Update followings_dynamic.js * Update router.js * Update followings_dynamic.js * Update social-media.md * Update social-media.md * Update followings_dynamic.js * Update followings_dynamic.js * Create .env * Update .env * Update followings_dynamic.js * Update router.js * Update followings_dynamic.js * Delete .env * [CodeFactor] Apply fixes [ci skip] [skip ci] * Update followings_dynamic.js 优化代码 * Update followings_dynamic.js * [CodeFactor] Apply fixes to commit 7a43db0 [ci skip] [skip ci] * Create .env * Update followings_dynamic.js * [CodeFactor] Apply fixes to commit 14dfa49 [ci skip] [skip ci] * Update followings_dynamic.js * Update followings_dynamic.js * [CodeFactor] Apply fixes to commit d60fc51 [ci skip] [skip ci] * Delete .env * Update followings_dynamic.js 优化代码 * [CodeFactor] Apply fixes to commit 8086726 [ci skip] [skip ci] * [CodeFactor] Apply fixes to commit e1c8843 [ci skip] [skip ci] * Update social-media.md * Update router.js Co-authored-by: TigerDen96 <55782476+TigerDen96@users.noreply.github.com> Co-authored-by: 小虎故洞 <55782476+XiaoHuGuDong@users.noreply.github.com> Co-authored-by: codefactor-io Co-authored-by: 小虎故洞 <55782476+TigerWolfDen@users.noreply.github.com> --- lib/router.js | 2 +- lib/routes/bilibili/followings_dynamic.js | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/router.js b/lib/router.js index 9be82d93c..f45228901 100644 --- a/lib/router.js +++ b/lib/router.js @@ -80,12 +80,12 @@ router.get('/bilibili/user/channel/:uid/:cid/:disableEmbed?', require('./routes/ router.get('/bilibili/topic/:topic', require('./routes/bilibili/topic')); router.get('/bilibili/audio/:id', require('./routes/bilibili/audio')); router.get('/bilibili/vsearch/:kw/:order?/:disableEmbed?', require('./routes/bilibili/vsearch')); +router.get('/bilibili/followings/dynamic/:uid/:disableEmbed?', require('./routes/bilibili/followings_dynamic')); router.get('/bilibili/followings/video/:uid/:disableEmbed?', require('./routes/bilibili/followings_video')); router.get('/bilibili/followings/article/:uid', require('./routes/bilibili/followings_article')); router.get('/bilibili/readlist/:listid', require('./routes/bilibili/readlist')); router.get('/bilibili/weekly', require('./routes/bilibili/weekly_recommend')); router.get('/bilibili/manga/update/:comicid', require('./routes/bilibili/manga_update')); -router.get('/bilibili/followings/dynamic/:uid/:disableEmbed?', require('./routes/bilibili/followings_dynamic')); router.get('/bilibili/app/:id?', require('./routes/bilibili/app')); // bangumi diff --git a/lib/routes/bilibili/followings_dynamic.js b/lib/routes/bilibili/followings_dynamic.js index af83923b9..5ada6c0b1 100644 --- a/lib/routes/bilibili/followings_dynamic.js +++ b/lib/routes/bilibili/followings_dynamic.js @@ -33,7 +33,7 @@ module.exports = async (ctx) => { description: `${name} 关注的动态`, item: data.map((item) => { const parsed = JSONbig.parse(item.card); - const data = parsed.item || parsed; + const data = parsed.apiSeasonInfo || parsed.item || parsed; const origin = parsed.origin ? JSONbig.parse(parsed.origin) : null; // img @@ -103,25 +103,30 @@ module.exports = async (ctx) => { // emoji let data_content = getDes(data); - if (item.display.emoji_info) { + if (item.display && item.display.emoji_info) { const emoji = item.display.emoji_info.emoji_details; emoji.forEach(function (item) { data_content = data_content.replace( new RegExp(`\\${item.text}`, 'g'), `${item.text}` - ); - }); - } + ); + }); + } + // 作者信息 + let author = "哔哩哔哩番剧"; + if (item.desc.user_profile) { + author = item.desc.user_profile.info.uname;} return { title: getTitle(data), - author: item.desc.user_profile.info.uname, - description: `${data_content || getDes(data)}${ + author : author, + description: `${parsed.new_desc || data_content || getDes(data)}${ origin && getOriginName(origin) ? `

//转发自: @${getOriginName(origin)}: ${getOriginTitle(origin.item || origin)}${getDes(origin.item || origin)}` : `${getOriginDes(origin)}` }${getIframe(data)}${getIframe(origin)}${imgHTML ? `
${imgHTML}` : ''}${videoHTML ? `
${videoHTML}` : ''}`, pubDate: new Date(item.desc.timestamp * 1000).toUTCString(), link: link, + }; }), }; -}; +}; \ No newline at end of file