From 08784f181a0fde2fc287ea2b9d653f806a72bd64 Mon Sep 17 00:00:00 2001 From: Rongrong <15956627+Rongronggg9@users.noreply.github.com> Date: Fri, 25 Feb 2022 07:41:02 +0800 Subject: [PATCH] feat(route)(weibo): add article pic (#9192) Signed-off-by: Rongrong <15956627+Rongronggg9@users.noreply.github.com> --- lib/routes/weibo/utils.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/routes/weibo/utils.js b/lib/routes/weibo/utils.js index a72ba6bb2..8d748816d 100644 --- a/lib/routes/weibo/utils.js +++ b/lib/routes/weibo/utils.js @@ -83,6 +83,22 @@ const weiboUtils = { html = usernameAndAvatar + html; } + // 添加文章头图 + if (status.page_info && status.page_info.type === 'article' && status.page_info.page_pic && status.page_info.page_pic.url) { + // 如果以后后续流程会用到其他字段,记得修改这里 + const pagePic = { + large: { + url: status.page_info.page_pic.url, + }, + }; + // 文章微博本身是没有配图的,但还是要以防万一 + if (status.pics) { + status.pics.push(pagePic); + } else { + status.pics = [pagePic]; + } + } + // 添加微博配图 if (status.pics) { if (readable) {