Skip to content

Commit

Permalink
fix: exclude comments in repost
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilfish committed Feb 26, 2024
1 parent e7def99 commit df38ce8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/utils/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ export async function postFilter(
const includeImgs = !isRepost || (isRepost && options.repostPic)
const imgSize = options.picLarge ? 'largest' : 'large'

// 转发的微博不需要评论
const includeComments = !isRepost && options.comment

try {
const res: Post = {
id: post.id,
Expand All @@ -152,7 +155,7 @@ export async function postFilter(
detail_url: `${weibo}/${post.user?.id}/${post.mblogid}`,
retweeted_status: await postFilter(post.retweeted_status, options, true),
card: parseCard(post.url_struct, post.page_info),
comments: options.comment ? await fetchComments(post) : [],
comments: includeComments ? await fetchComments(post) : [],
}

return res
Expand Down

0 comments on commit df38ce8

Please sign in to comment.