From c2d94c48c06973adf19c74ca4ea19052ba1483fc Mon Sep 17 00:00:00 2001 From: Cloud Date: Tue, 3 Sep 2019 23:10:18 +0800 Subject: [PATCH] fix: douban people status (#2989) --- lib/routes/douban/people/status.js | 38 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/lib/routes/douban/people/status.js b/lib/routes/douban/people/status.js index 0b58c3feeb..a87137b334 100644 --- a/lib/routes/douban/people/status.js +++ b/lib/routes/douban/people/status.js @@ -12,11 +12,18 @@ function getContentByActivity(status) { }); break; case '转发': - description = getContentByActivity(status.reshared_status).title; - title = `${status.author.name} ${status.activity} ${status.reshared_status.author.name} 的广播:${status.reshared_status.text}`; - status.reshared_status.images.forEach((image) => { - description += `

`; - }); + description = `${status.text}
`; + if (status.reshared_status.deleted) { + title = `${status.author.name} ${status.activity} 广播:原动态已被发布者删除`; + description += `原动态已被发布者删除`; + } else { + description += getContentByActivity(status.reshared_status).title; + title = `${status.author.name} ${status.activity} ${status.reshared_status.author.name} 的广播:${status.reshared_status.text}`; + status.reshared_status.images.forEach((image) => { + description += `

`; + }); + } + break; default: if (status.card) { @@ -44,19 +51,22 @@ module.exports = async (ctx) => { Referer: `https://m.douban.com/people/${userid}/statuses`, }, }); + const items = response.data.items; ctx.state.data = { title: `豆瓣广播-${userid}`, link: `https://m.douban.com/people/${userid}/statuses`, - item: items.map((item) => { - const r = getContentByActivity(item.status); - return { - title: r.title, - link: item.status.sharing_url, - pubDate: item.status.create_time, - description: r.description, - }; - }), + item: items + .filter((item) => !item.deleted) + .map((item) => { + const r = getContentByActivity(item.status); + return { + title: r.title, + link: item.status.sharing_url, + pubDate: item.status.create_time, + description: r.description, + }; + }), }; };