feat: generate quote content_html, telegram channel repost extra data

This commit is contained in:
DIYgod
2023-01-30 22:00:07 +00:00
parent 6b4fb8fd8a
commit 52678c9eef
4 changed files with 17 additions and 2 deletions

View File

@@ -139,6 +139,11 @@ module.exports = async (ctx, next) => {
}); });
item.description = $('body').html() + '' + (config.suffix || ''); item.description = $('body').html() + '' + (config.suffix || '');
const quote = item._extra?.links?.find((e) => e.type === 'quote');
if (quote && $('.rsshub-quote').length) {
quote.content_html = $.html($('.rsshub-quote'));
}
} }
return item; return item;
}; };

View File

@@ -112,7 +112,6 @@ module.exports = async (ctx) => {
links: [ links: [
{ {
url: getLink(item.target.id, item.target.type), url: getLink(item.target.id, item.target.type),
content_html: repostContent,
type: 'quote', type: 'quote',
}, },
], ],

View File

@@ -120,6 +120,7 @@ module.exports = async (ctx) => {
list list
.map((index, item) => { .map((index, item) => {
item = $(item); item = $(item);
let extra = null;
/* message types */ /* message types */
let msgTypes = []; let msgTypes = [];
@@ -208,6 +209,15 @@ module.exports = async (ctx) => {
fwdFrom += ` (${fwdFromAuthorObj.text()})`; fwdFrom += ` (${fwdFromAuthorObj.text()})`;
} }
fwdFrom += '</p>'; fwdFrom += '</p>';
extra = {
links: [
{
type: 'repost',
url: userLink,
},
],
};
} }
return fwdFrom; return fwdFrom;
}; };
@@ -576,6 +586,8 @@ module.exports = async (ctx) => {
enclosure_url: voiceUrl, enclosure_url: voiceUrl,
itunes_duration: voiceDuration(), itunes_duration: voiceDuration(),
enclosure_type: 'audio/ogg', enclosure_type: 'audio/ogg',
_extra: extra,
}; };
}) })
.get() .get()

View File

@@ -397,7 +397,6 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
links: [ links: [
{ {
url: `https://twitter.com/${item.quoted_status?.user?.screen_name}/status/${item.quoted_status?.id_str}`, url: `https://twitter.com/${item.quoted_status?.user?.screen_name}/status/${item.quoted_status?.id_str}`,
content_html: quote,
type: 'quote', type: 'quote',
}, },
], ],