Parse some fields off each item
This commit is contained in:
parent
8257347a09
commit
28788c8fc0
|
@ -3,6 +3,10 @@ import { Item } from "rss-parser";
|
|||
|
||||
export function toEvent(item: Item): FeedEventData {
|
||||
return {
|
||||
guid: item.guid || item.link || item.title || Math.random().toString(32)
|
||||
guid: item.guid || item.link || item.title || Math.random().toString(32),
|
||||
title: item.title || "Unnamed event",
|
||||
link: item.link,
|
||||
creator: item.creator || "Unknown",
|
||||
published: item.pubDate ? new Date(item.pubDate) : undefined
|
||||
};
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@ export interface FeedEvent {
|
|||
|
||||
export interface FeedEventData {
|
||||
guid: string;
|
||||
title: string;
|
||||
link?: string;
|
||||
creator: string;
|
||||
published?: Date;
|
||||
}
|
||||
|
||||
export interface FetchStatus {
|
||||
|
|
Loading…
Reference in New Issue
Block a user