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 || '');
const quote = item._extra?.links?.find((e) => e.type === 'quote');
if (quote && $('.rsshub-quote').length) {
quote.content_html = $.html($('.rsshub-quote'));
}
}
return item;
};

View File

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

View File

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

View File

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