feedsmith
Version:
Fast, all‑in‑one feed parser and generator for RSS, Atom, RDF, and JSON Feed, with support for Podcast, iTunes, Dublin Core, and OPML files.
74 lines (73 loc) • 2.03 kB
JavaScript
import { namespacePrefixes, namespaceStopNodes, namespaceUris, parserConfig } from "../../../common/config.js";
import { createNamespaceNormalizator } from "../../../common/utils.js";
import { XMLParser } from "fast-xml-parser";
//#region src/feeds/atom/parse/config.ts
const stopNodes = [
...namespaceStopNodes,
"feed.author.name",
"feed.author.uri",
"feed.author.url",
"feed.author.email",
"feed.category",
"feed.contributor.name",
"feed.contributor.uri",
"feed.contributor.url",
"feed.contributor.email",
"feed.generator",
"feed.icon",
"feed.id",
"feed.link",
"feed.logo",
"feed.rights",
"feed.subtitle",
"feed.tagline",
"feed.title",
"feed.updated",
"feed.modified",
"feed.entry.author.name",
"feed.entry.author.uri",
"feed.entry.author.url",
"feed.entry.author.email",
"feed.entry.category",
"feed.entry.content",
"feed.entry.contributor.name",
"feed.entry.contributor.uri",
"feed.entry.contributor.url",
"feed.entry.contributor.email",
"feed.entry.id",
"feed.entry.link",
"feed.entry.published",
"feed.entry.issued",
"feed.entry.created",
"feed.entry.rights",
"feed.entry.source.author.name",
"feed.entry.source.author.uri",
"feed.entry.source.author.url",
"feed.entry.source.author.email",
"feed.entry.source.category",
"feed.entry.source.contributor.name",
"feed.entry.source.contributor.uri",
"feed.entry.source.contributor.url",
"feed.entry.source.contributor.email",
"feed.entry.source.generator",
"feed.entry.source.icon",
"feed.entry.source.id",
"feed.entry.source.link",
"feed.entry.source.logo",
"feed.entry.source.rights",
"feed.entry.source.subtitle",
"feed.entry.source.title",
"feed.entry.source.updated",
"feed.entry.source.modified",
"feed.entry.summary",
"feed.entry.title",
"feed.entry.updated",
"feed.entry.modified"
];
const parser = new XMLParser({
...parserConfig,
stopNodes
});
const normalizeNamespaces = createNamespaceNormalizator(namespaceUris, namespacePrefixes, ["atom"]);
//#endregion
export { normalizeNamespaces, parser, stopNodes };