Skip to content
Live demo

Feed parsing

src/server/utils/parse-feed.ts uses the pinned stable FeedSmith package. parseSyndication converts its format-specific output into Sparkfeed’s shared FeedItem shape. Discovery, catalogue previews, and ingestion use this adapter.

The adapter preserves publisher IDs, article links, full bodies, summaries, authors, media images, and separate publication and update dates. Atom links prefer HTML alternatives over self and enclosure links. Executable URLs and URLs containing credentials are rejected.

safeParseDate normalizes supported date strings to UTC ISO timestamps. Invalid dates remain unknown. An update date is not silently treated as a publication date. Ingestion preserves an existing date if the publisher later omits it.

Full feed bodies are sanitized with sanitizeArticleHtml in src/server/utils/extract.ts. The sanitizer removes scripts, event handlers, and iframes while retaining reader formatting. Readability extracts article bodies when the feed does not supply one.

FeedSmith parses content; it does not make outbound requests or sanitize HTML. DTD and entity declarations are rejected before parsing. Card excerpts are bounded independently of the full stored body.

See FeedSmith’s parsing API and date handling.