diff --git a/lib/routes/weibo/timeline.js b/lib/routes/weibo/timeline.js
index cf9b8deab..13866f12f 100644
--- a/lib/routes/weibo/timeline.js
+++ b/lib/routes/weibo/timeline.js
@@ -78,12 +78,22 @@ module.exports = async (ctx) => {
// 视频的处理
if (displayVideo === '1') {
- description = weiboUtils.formatVideo(description, item);
+ // 含被转发微博时需要从被转发微博中获取视频
+ if (item.retweeted_status) {
+ description = weiboUtils.formatVideo(description, item.retweeted_status);
+ } else {
+ description = weiboUtils.formatVideo(description, item);
+ }
}
// 文章的处理
if (displayArticle === '1') {
- description = await weiboUtils.formatArticle(ctx, description, item);
+ // 含被转发微博时需要从被转发微博中获取文章
+ if (item.retweeted_status) {
+ description = await weiboUtils.formatArticle(ctx, description, item.retweeted_status);
+ } else {
+ description = await weiboUtils.formatArticle(ctx, description, item);
+ }
}
return {
diff --git a/lib/routes/weibo/user.js b/lib/routes/weibo/user.js
index 506f50905..b0557914f 100644
--- a/lib/routes/weibo/user.js
+++ b/lib/routes/weibo/user.js
@@ -94,18 +94,27 @@ module.exports = async (ctx) => {
const link = `https://weibo.com/${uid}/${item.mblog.bid}`;
const formatExtended = weiboUtils.formatExtended(ctx, item.mblog);
let description = formatExtended.description;
- const formattedTitle = formatExtended.title;
- const title = formattedTitle;
+ const title = formatExtended.title;
const pubDate = item.mblog.created_at;
// 视频的处理
if (displayVideo === '1') {
- description = weiboUtils.formatVideo(description, item.mblog);
+ // 含被转发微博时需要从被转发微博中获取视频
+ if (item.mblog.retweeted_status) {
+ description = weiboUtils.formatVideo(description, item.mblog.retweeted_status);
+ } else {
+ description = weiboUtils.formatVideo(description, item.mblog);
+ }
}
// 文章的处理
if (displayArticle === '1') {
- description = await weiboUtils.formatArticle(ctx, description, item.mblog);
+ // 含被转发微博时需要从被转发微博中获取文章
+ if (item.mblog.retweeted_status) {
+ description = await weiboUtils.formatArticle(ctx, description, item.mblog.retweeted_status);
+ } else {
+ description = await weiboUtils.formatArticle(ctx, description, item.mblog);
+ }
}
return {
diff --git a/lib/routes/weibo/utils.js b/lib/routes/weibo/utils.js
index 15d9b140f..604b724e2 100644
--- a/lib/routes/weibo/utils.js
+++ b/lib/routes/weibo/utils.js
@@ -84,7 +84,7 @@ 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 = {
@@ -92,7 +92,7 @@ const weiboUtils = {
url: status.page_info.page_pic.url,
},
};
- // 文章微博本身是没有配图的,但还是要以防万一
+ // 文章微博一般不会有配图,但也有可能有:https://weibo.com/6882481489/Lh85BkS3m
if (status.pics) {
status.pics.push(pagePic);
} else {
@@ -292,14 +292,15 @@ const weiboUtils = {
const isOriginal = article.is_original;
const isArticleNonFree = article.is_article_free; // 微博起错了字段名,它为 1 时才是收费文章
+ // 许多微博文章都给文字设置了白色背景,这里也只好使用白色背景了
let html = '
';
- html += '
'; if (isArticleNonFree) { articleMeta += `试读 `;