Files
RSSHub/lib/routes/crossbell/notes/utils.ts
T
Bangwuandgithub-actions[bot] 36077f2e0a fix(route): fix crossbell character and the following output (#15417)
* fix: following.ts

* fix: character.ts

* Update following.ts

* style: auto format

* for source and index route

* style: auto format

* remove change

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-04-30 21:51:43 +08:00

17 lines
846 B
TypeScript

export const getItem = (note) => {
let link = note.metadata?.content?.external_urls?.[0] ?? `https://crossbell.io/notes/${note.characterId}-${note.noteId}`;
if (link.startsWith('https://xn--')) {
link = `https://crossbell.io/notes/${note.characterId}-${note.noteId}`;
}
return {
title: note.metadata?.content?.title || '',
description: note.metadata?.content?.content,
link,
pubDate: note.metadata?.content?.publishedAt,
updated: note.metadata?.content?.updatedAt,
author: note.metadata?.content?.authors?.[0] || note.character?.metadata?.content?.name || note.character?.handle,
guid: `https://crossbell.io/notes/${note.characterId}-${note.noteId}`,
category: [...(note.metadata?.content?.sources || []), ...(note.metadata?.content?.tags || [])],
};
};