feat: quote repost and reply info for twitter and jike

This commit is contained in:
DIYgod 2023-01-10 17:57:53 +00:00
parent aa163f433d
commit cb03dd3059
No known key found for this signature in database
GPG Key ID: D159328F47A80DCA
2 changed files with 33 additions and 10 deletions

View File

@ -109,10 +109,13 @@ module.exports = async (ctx) => {
pubDate: parseDate(item.createdAt),
link: getLink(item.id, item.type),
_extra: repostContent && {
quote: {
url: getLink(item.target.id, item.target.type),
content_html: repostContent,
},
links: [
{
url: getLink(item.target.id, item.target.type),
content_html: repostContent,
type: 'quote',
},
],
},
};

View File

@ -385,12 +385,32 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
pubDate: parseDate(item.created_at),
link: `https://twitter.com/${item.user.screen_name}/status/${item.id_str}`,
_extra: item.is_quote_status && {
quote: {
url: `https://twitter.com/${item.quoted_status.user?.screen_name}/status/${item.quoted_status.id_str}`,
content_html: quote,
},
},
_extra:
(isRetweet && {
links: [
{
type: 'repost',
},
],
}) ||
(item.is_quote_status && {
links: [
{
url: `https://twitter.com/${item.quoted_status.user?.screen_name}/status/${item.quoted_status.id_str}`,
content_html: quote,
type: 'quote',
},
],
}) ||
(item.in_reply_to_screen_name &&
item.in_reply_to_status_id_str && {
links: [
{
url: `https://twitter.com/${item.in_reply_to_screen_name}/status/${item.in_reply_to_status_id_str}`,
type: 'reply',
},
],
}),
};
});
};