feedsmith 1.9.0 → 2.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +382 -72
- package/dist/common/config.d.ts +18 -1
- package/dist/common/config.js +25 -0
- package/dist/common/config.js.map +1 -1
- package/dist/common/parse.d.ts +9 -8
- package/dist/common/parse.js.map +1 -1
- package/dist/common/types.d.ts +25 -1
- package/dist/common/utils.d.ts +27 -15
- package/dist/common/utils.js +323 -51
- package/dist/common/utils.js.map +1 -1
- package/dist/feeds/atom/common/types.d.ts +103 -0
- package/dist/feeds/atom/common/types.js.map +1 -0
- package/dist/feeds/atom/detect/index.js +11 -1
- package/dist/feeds/atom/detect/index.js.map +1 -1
- package/dist/feeds/atom/generate/config.d.ts +2 -0
- package/dist/feeds/atom/generate/config.js +6 -0
- package/dist/feeds/atom/generate/config.js.map +1 -0
- package/dist/feeds/atom/generate/index.d.ts +3 -0
- package/dist/feeds/atom/generate/index.js +11 -0
- package/dist/feeds/atom/generate/index.js.map +1 -0
- package/dist/feeds/atom/generate/utils.d.ts +10 -0
- package/dist/feeds/atom/generate/utils.js +182 -0
- package/dist/feeds/atom/generate/utils.js.map +1 -0
- package/dist/feeds/atom/parse/config.js +1 -1
- package/dist/feeds/atom/parse/config.js.map +1 -1
- package/dist/feeds/atom/parse/index.d.ts +3 -2
- package/dist/feeds/atom/parse/index.js +5 -2
- package/dist/feeds/atom/parse/index.js.map +1 -1
- package/dist/feeds/atom/parse/utils.d.ts +16 -15
- package/dist/feeds/atom/parse/utils.js +84 -86
- package/dist/feeds/atom/parse/utils.js.map +1 -1
- package/dist/feeds/json/{generate → common}/types.d.ts +9 -8
- package/dist/feeds/json/common/types.js.map +1 -0
- package/dist/feeds/json/detect/index.js +14 -2
- package/dist/feeds/json/detect/index.js.map +1 -1
- package/dist/feeds/json/generate/index.d.ts +2 -2
- package/dist/feeds/json/generate/index.js.map +1 -1
- package/dist/feeds/json/generate/utils.d.ts +31 -32
- package/dist/feeds/json/generate/utils.js +4 -9
- package/dist/feeds/json/generate/utils.js.map +1 -1
- package/dist/feeds/json/parse/index.d.ts +3 -2
- package/dist/feeds/json/parse/index.js.map +1 -1
- package/dist/feeds/json/parse/utils.d.ts +9 -8
- package/dist/feeds/json/parse/utils.js +34 -29
- package/dist/feeds/json/parse/utils.js.map +1 -1
- package/dist/feeds/rdf/common/types.d.ts +48 -0
- package/dist/feeds/{rss/parse → rdf/common}/types.js.map +1 -1
- package/dist/feeds/rdf/detect/index.js +12 -1
- package/dist/feeds/rdf/detect/index.js.map +1 -1
- package/dist/feeds/rdf/parse/config.js +1 -1
- package/dist/feeds/rdf/parse/config.js.map +1 -1
- package/dist/feeds/rdf/parse/index.d.ts +3 -2
- package/dist/feeds/rdf/parse/index.js +5 -2
- package/dist/feeds/rdf/parse/index.js.map +1 -1
- package/dist/feeds/rdf/parse/utils.d.ts +10 -10
- package/dist/feeds/rdf/parse/utils.js +52 -56
- package/dist/feeds/rdf/parse/utils.js.map +1 -1
- package/dist/feeds/rss/common/types.d.ts +111 -0
- package/dist/feeds/{json/parse → rss/common}/types.js.map +1 -1
- package/dist/feeds/rss/detect/index.js +11 -1
- package/dist/feeds/rss/detect/index.js.map +1 -1
- package/dist/feeds/rss/generate/config.d.ts +2 -0
- package/dist/feeds/rss/generate/config.js +6 -0
- package/dist/feeds/rss/generate/config.js.map +1 -0
- package/dist/feeds/rss/generate/index.d.ts +3 -0
- package/dist/feeds/rss/generate/index.js +11 -0
- package/dist/feeds/rss/generate/index.js.map +1 -0
- package/dist/feeds/rss/generate/utils.d.ts +14 -0
- package/dist/feeds/rss/generate/utils.js +182 -0
- package/dist/feeds/rss/generate/utils.js.map +1 -0
- package/dist/feeds/rss/parse/config.js +1 -1
- package/dist/feeds/rss/parse/config.js.map +1 -1
- package/dist/feeds/rss/parse/index.d.ts +3 -2
- package/dist/feeds/rss/parse/index.js +5 -2
- package/dist/feeds/rss/parse/index.js.map +1 -1
- package/dist/feeds/rss/parse/utils.d.ts +15 -14
- package/dist/feeds/rss/parse/utils.js +101 -113
- package/dist/feeds/rss/parse/utils.js.map +1 -1
- package/dist/index.d.ts +14 -13
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/namespaces/atom/common/types.d.ts +4 -0
- package/dist/namespaces/atom/common/types.js.map +1 -0
- package/dist/namespaces/atom/generate/utils.d.ts +4 -0
- package/dist/namespaces/atom/generate/utils.js +8 -0
- package/dist/namespaces/atom/generate/utils.js.map +1 -0
- package/dist/namespaces/atom/parse/utils.d.ts +4 -0
- package/dist/namespaces/atom/parse/utils.js +8 -0
- package/dist/namespaces/atom/parse/utils.js.map +1 -0
- package/dist/namespaces/content/common/types.js.map +1 -0
- package/dist/namespaces/content/generate/utils.d.ts +3 -0
- package/dist/namespaces/content/generate/utils.js +11 -0
- package/dist/namespaces/content/generate/utils.js.map +1 -0
- package/dist/namespaces/content/parse/utils.d.ts +3 -0
- package/dist/namespaces/content/parse/utils.js +11 -0
- package/dist/namespaces/content/parse/utils.js.map +1 -0
- package/dist/namespaces/dc/{types.d.ts → common/types.d.ts} +3 -2
- package/dist/namespaces/dc/common/types.js.map +1 -0
- package/dist/namespaces/dc/generate/utils.d.ts +3 -0
- package/dist/namespaces/dc/generate/utils.js +25 -0
- package/dist/namespaces/dc/generate/utils.js.map +1 -0
- package/dist/namespaces/dc/parse/utils.d.ts +3 -0
- package/dist/namespaces/dc/parse/utils.js +25 -0
- package/dist/namespaces/dc/parse/utils.js.map +1 -0
- package/dist/namespaces/dcterms/common/types.d.ts +58 -0
- package/dist/namespaces/dcterms/common/types.js.map +1 -0
- package/dist/namespaces/dcterms/generate/utils.d.ts +3 -0
- package/dist/namespaces/dcterms/generate/utils.js +65 -0
- package/dist/namespaces/dcterms/generate/utils.js.map +1 -0
- package/dist/namespaces/dcterms/parse/utils.d.ts +3 -0
- package/dist/namespaces/dcterms/parse/utils.js +65 -0
- package/dist/namespaces/dcterms/parse/utils.js.map +1 -0
- package/dist/namespaces/georss/{types.d.ts → common/types.d.ts} +6 -6
- package/dist/namespaces/georss/common/types.js.map +1 -0
- package/dist/namespaces/georss/generate/utils.d.ts +11 -0
- package/dist/namespaces/georss/generate/utils.js +61 -0
- package/dist/namespaces/georss/generate/utils.js.map +1 -0
- package/dist/namespaces/georss/parse/utils.d.ts +11 -0
- package/dist/namespaces/georss/{utils.js → parse/utils.js} +14 -16
- package/dist/namespaces/georss/parse/utils.js.map +1 -0
- package/dist/namespaces/itunes/{types.d.ts → common/types.d.ts} +2 -2
- package/dist/namespaces/itunes/common/types.js.map +1 -0
- package/dist/namespaces/itunes/generate/utils.d.ts +7 -0
- package/dist/namespaces/itunes/generate/utils.js +71 -0
- package/dist/namespaces/itunes/generate/utils.js.map +1 -0
- package/dist/namespaces/itunes/parse/utils.d.ts +9 -0
- package/dist/namespaces/itunes/{utils.js → parse/utils.js} +27 -31
- package/dist/namespaces/itunes/parse/utils.js.map +1 -0
- package/dist/namespaces/media/{types.d.ts → common/types.d.ts} +24 -20
- package/dist/namespaces/media/common/types.js.map +1 -0
- package/dist/namespaces/media/generate/utils.d.ts +33 -0
- package/dist/namespaces/media/generate/utils.js +351 -0
- package/dist/namespaces/media/generate/utils.js.map +1 -0
- package/dist/namespaces/media/parse/utils.d.ts +35 -0
- package/dist/namespaces/media/{utils.js → parse/utils.js} +65 -107
- package/dist/namespaces/media/parse/utils.js.map +1 -0
- package/dist/namespaces/podcast/{types.d.ts → common/types.d.ts} +62 -60
- package/dist/namespaces/podcast/common/types.js.map +1 -0
- package/dist/namespaces/podcast/generate/utils.d.ts +32 -0
- package/dist/namespaces/podcast/generate/utils.js +363 -0
- package/dist/namespaces/podcast/generate/utils.js.map +1 -0
- package/dist/namespaces/podcast/parse/utils.d.ts +31 -0
- package/dist/namespaces/podcast/{utils.js → parse/utils.js} +48 -102
- package/dist/namespaces/podcast/parse/utils.js.map +1 -0
- package/dist/namespaces/slash/{types.d.ts → common/types.d.ts} +1 -1
- package/dist/namespaces/slash/common/types.js.map +1 -0
- package/dist/namespaces/slash/generate/utils.d.ts +3 -0
- package/dist/namespaces/slash/generate/utils.js +14 -0
- package/dist/namespaces/slash/generate/utils.js.map +1 -0
- package/dist/namespaces/slash/parse/utils.d.ts +4 -0
- package/dist/namespaces/slash/parse/utils.js +17 -0
- package/dist/namespaces/slash/parse/utils.js.map +1 -0
- package/dist/namespaces/sy/common/types.d.ts +6 -0
- package/dist/namespaces/sy/common/types.js.map +1 -0
- package/dist/namespaces/sy/generate/utils.d.ts +3 -0
- package/dist/namespaces/sy/generate/utils.js +13 -0
- package/dist/namespaces/sy/generate/utils.js.map +1 -0
- package/dist/namespaces/sy/parse/utils.d.ts +3 -0
- package/dist/namespaces/sy/parse/utils.js +13 -0
- package/dist/namespaces/sy/parse/utils.js.map +1 -0
- package/dist/namespaces/thr/{types.d.ts → common/types.d.ts} +4 -6
- package/dist/namespaces/thr/common/types.js.map +1 -0
- package/dist/namespaces/thr/generate/utils.d.ts +5 -0
- package/dist/namespaces/thr/generate/utils.js +34 -0
- package/dist/namespaces/thr/generate/utils.js.map +1 -0
- package/dist/namespaces/thr/parse/utils.d.ts +5 -0
- package/dist/namespaces/thr/{utils.js → parse/utils.js} +4 -6
- package/dist/namespaces/thr/parse/utils.js.map +1 -0
- package/dist/namespaces/wfw/common/types.d.ts +4 -0
- package/dist/namespaces/wfw/common/types.js.map +1 -0
- package/dist/namespaces/wfw/generate/utils.d.ts +3 -0
- package/dist/namespaces/wfw/generate/utils.js +12 -0
- package/dist/namespaces/wfw/generate/utils.js.map +1 -0
- package/dist/namespaces/wfw/parse/utils.d.ts +3 -0
- package/dist/namespaces/wfw/parse/utils.js +12 -0
- package/dist/namespaces/wfw/parse/utils.js.map +1 -0
- package/dist/namespaces/yt/common/types.d.ts +8 -0
- package/dist/namespaces/yt/common/types.js.map +1 -0
- package/dist/namespaces/yt/generate/utils.d.ts +4 -0
- package/dist/namespaces/yt/generate/utils.js +22 -0
- package/dist/namespaces/yt/generate/utils.js.map +1 -0
- package/dist/namespaces/yt/parse/utils.d.ts +4 -0
- package/dist/namespaces/yt/parse/utils.js +22 -0
- package/dist/namespaces/yt/parse/utils.js.map +1 -0
- package/dist/opml/{generate → common}/types.d.ts +12 -11
- package/dist/opml/common/types.js +2 -0
- package/dist/opml/{parse → common}/types.js.map +1 -1
- package/dist/opml/generate/config.js +2 -6
- package/dist/opml/generate/config.js.map +1 -1
- package/dist/opml/generate/index.d.ts +3 -2
- package/dist/opml/generate/index.js +3 -6
- package/dist/opml/generate/index.js.map +1 -1
- package/dist/opml/generate/utils.d.ts +6 -44
- package/dist/opml/generate/utils.js +50 -60
- package/dist/opml/generate/utils.js.map +1 -1
- package/dist/opml/parse/index.d.ts +3 -2
- package/dist/opml/parse/index.js.map +1 -1
- package/dist/opml/parse/utils.d.ts +6 -6
- package/dist/opml/parse/utils.js +26 -26
- package/dist/opml/parse/utils.js.map +1 -1
- package/package.json +10 -7
- package/dist/feeds/atom/parse/types.d.ts +0 -91
- package/dist/feeds/atom/parse/types.js.map +0 -1
- package/dist/feeds/json/generate/types.js.map +0 -1
- package/dist/feeds/json/parse/types.d.ts +0 -49
- package/dist/feeds/rdf/parse/types.d.ts +0 -42
- package/dist/feeds/rdf/parse/types.js.map +0 -1
- package/dist/feeds/rss/parse/types.d.ts +0 -96
- package/dist/namespaces/atom/types.d.ts +0 -1
- package/dist/namespaces/atom/types.js.map +0 -1
- package/dist/namespaces/atom/utils.d.ts +0 -4
- package/dist/namespaces/atom/utils.js +0 -10
- package/dist/namespaces/atom/utils.js.map +0 -1
- package/dist/namespaces/content/types.js.map +0 -1
- package/dist/namespaces/content/utils.d.ts +0 -3
- package/dist/namespaces/content/utils.js +0 -11
- package/dist/namespaces/content/utils.js.map +0 -1
- package/dist/namespaces/dc/types.js.map +0 -1
- package/dist/namespaces/dc/utils.d.ts +0 -3
- package/dist/namespaces/dc/utils.js +0 -25
- package/dist/namespaces/dc/utils.js.map +0 -1
- package/dist/namespaces/georss/types.js.map +0 -1
- package/dist/namespaces/georss/utils.d.ts +0 -11
- package/dist/namespaces/georss/utils.js.map +0 -1
- package/dist/namespaces/itunes/types.js.map +0 -1
- package/dist/namespaces/itunes/utils.d.ts +0 -9
- package/dist/namespaces/itunes/utils.js.map +0 -1
- package/dist/namespaces/media/types.js.map +0 -1
- package/dist/namespaces/media/utils.d.ts +0 -35
- package/dist/namespaces/media/utils.js.map +0 -1
- package/dist/namespaces/podcast/types.js.map +0 -1
- package/dist/namespaces/podcast/utils.d.ts +0 -31
- package/dist/namespaces/podcast/utils.js.map +0 -1
- package/dist/namespaces/slash/types.js.map +0 -1
- package/dist/namespaces/slash/utils.d.ts +0 -4
- package/dist/namespaces/slash/utils.js +0 -23
- package/dist/namespaces/slash/utils.js.map +0 -1
- package/dist/namespaces/sy/types.d.ts +0 -5
- package/dist/namespaces/sy/types.js.map +0 -1
- package/dist/namespaces/sy/utils.d.ts +0 -3
- package/dist/namespaces/sy/utils.js +0 -13
- package/dist/namespaces/sy/utils.js.map +0 -1
- package/dist/namespaces/thr/types.js.map +0 -1
- package/dist/namespaces/thr/utils.d.ts +0 -5
- package/dist/namespaces/thr/utils.js.map +0 -1
- package/dist/opml/generate/types.js.map +0 -1
- package/dist/opml/parse/types.d.ts +0 -38
- /package/dist/feeds/atom/{parse → common}/types.js +0 -0
- /package/dist/feeds/json/{generate → common}/types.js +0 -0
- /package/dist/feeds/{json/parse → rdf/common}/types.js +0 -0
- /package/dist/feeds/{rdf/parse → rss/common}/types.js +0 -0
- /package/dist/{feeds/rss/parse → namespaces/atom/common}/types.js +0 -0
- /package/dist/namespaces/content/{types.d.ts → common/types.d.ts} +0 -0
- /package/dist/namespaces/{atom → content/common}/types.js +0 -0
- /package/dist/namespaces/{content → dc/common}/types.js +0 -0
- /package/dist/namespaces/{dc → dcterms/common}/types.js +0 -0
- /package/dist/namespaces/georss/{types.js → common/types.js} +0 -0
- /package/dist/namespaces/itunes/{types.js → common/types.js} +0 -0
- /package/dist/namespaces/media/{types.js → common/types.js} +0 -0
- /package/dist/namespaces/podcast/{types.js → common/types.js} +0 -0
- /package/dist/namespaces/slash/{types.js → common/types.js} +0 -0
- /package/dist/namespaces/sy/{types.js → common/types.js} +0 -0
- /package/dist/namespaces/thr/{types.js → common/types.js} +0 -0
- /package/dist/{opml/generate → namespaces/wfw/common}/types.js +0 -0
- /package/dist/{opml/parse → namespaces/yt/common}/types.js +0 -0
package/README.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Feedsmith
|
|
2
2
|
|
|
3
3
|
[](https://github.com/macieklamberski/feedsmith/actions/workflows/test.yml)
|
|
4
|
+
[](https://codecov.io/gh/macieklamberski/feedsmith)
|
|
4
5
|
[](https://www.npmjs.com/package/feedsmith)
|
|
5
6
|
[](https://github.com/macieklamberski/feedsmith/blob/main/LICENSE)
|
|
6
7
|
|
|
7
|
-
Robust and fast JavaScript parser and generator for RSS, Atom, JSON Feed, and RDF feeds, with support for popular namespaces and OPML files.
|
|
8
|
+
Robust and fast JavaScript parser and generator for RSS, Atom, JSON Feed, and RDF feeds, with support for popular namespaces and OPML files.
|
|
8
9
|
|
|
9
|
-
Feedsmith
|
|
10
|
+
Feedsmith provides both universal and format-specific parsers that maintain the original feed structure in a clean, object-oriented format while intelligently normalizing legacy elements. Access all feed data without compromising simplicity.
|
|
11
|
+
|
|
12
|
+
> [!IMPORTANT]
|
|
13
|
+
>
|
|
14
|
+
> You're viewing the README for the next version of Feedsmith (v2.0), which includes major improvements and breaking changes. While the codebase is stable, the API may still undergo slight changes. This version is currently only available through the `next` channel for early testing. For production use, it is recommended to use the latest stable version.
|
|
15
|
+
> ```bash
|
|
16
|
+
> npm install feedsmith@latest # Stable version 1.9.0
|
|
17
|
+
> npm install feedsmith@next # Development version 2.0.0-next.x
|
|
18
|
+
> ```
|
|
10
19
|
|
|
11
20
|
[Features](#supported-formats)
|
|
12
21
|
·
|
|
@@ -24,13 +33,14 @@ Feedsmith maintains the original feed structure in a clean, object-oriented form
|
|
|
24
33
|
|
|
25
34
|
#### Leniency
|
|
26
35
|
* **Normalizes legacy elements** ✨ — Upgrades feed elements to their modern equivalents so that you never need to worry about reading feeds in older formats.
|
|
27
|
-
* **CaSe INSENsiTive** — Handles fields and attributes in any case (lowercase, uppercase, mixed).
|
|
36
|
+
* **CaSe INSENsiTive** 🐍 — Handles fields and attributes in any case (lowercase, uppercase, mixed).
|
|
37
|
+
* **Smart namespace handling** 🧠 — Automatically normalizes custom namespace prefixes to standard ones (e.g., `<custom:creator>` becomes `dc.creator`).
|
|
28
38
|
|
|
29
39
|
#### Performance and type-safety
|
|
30
|
-
* **Fast parsing** — One of the fastest feed parsers in JavaScript (see [benchmarks](#benchmarks)).
|
|
31
|
-
* **Type-safe API** — TypeScript type definitions are available for each feed format, making it easy to work with the data.
|
|
32
|
-
* **Tree-shakable** — Only include the parts of the library you need, reducing bundle size.
|
|
33
|
-
* **Well-tested** — Comprehensive test suite with
|
|
40
|
+
* **Fast parsing** ⚡ — One of the fastest feed parsers in JavaScript (see [benchmarks](#benchmarks)).
|
|
41
|
+
* **Type-safe API** 🛟 — TypeScript type definitions are available for each feed format, making it easy to work with the data.
|
|
42
|
+
* **Tree-shakable** 🍃 — Only include the parts of the library you need, reducing bundle size.
|
|
43
|
+
* **Well-tested** 🔬 — Comprehensive test suite with over 2000 tests and 99% code coverage.
|
|
34
44
|
|
|
35
45
|
#### Compatibility
|
|
36
46
|
* Works in Node.js and all modern browsers.
|
|
@@ -44,35 +54,38 @@ Feedsmith maintains the original feed structure in a clean, object-oriented form
|
|
|
44
54
|
·
|
|
45
55
|
📋 Planned
|
|
46
56
|
|
|
47
|
-
|
|
48
57
|
### Feeds
|
|
49
58
|
|
|
50
59
|
| Format | Versions | Parsing | Generating |
|
|
51
60
|
|--------|----------|---------|------------|
|
|
52
|
-
| [RSS](http://cyber.law.harvard.edu/rss/rss.html) | 0.9x, 2.0 | ✅ |
|
|
53
|
-
| [Atom](https://tools.ietf.org/html/rfc4287) | 0.3, 1.0 | ✅ |
|
|
61
|
+
| [RSS](http://cyber.law.harvard.edu/rss/rss.html) | 0.9x, 2.0 | ✅ | ✅ |
|
|
62
|
+
| [Atom](https://tools.ietf.org/html/rfc4287) | 0.3, 1.0 | ✅ | ✅ |
|
|
54
63
|
| [JSON Feed](https://jsonfeed.org) | 1.0, 1.1 | ✅ | ✅ |
|
|
55
64
|
| [RDF](https://web.resource.org/rss/1.0/spec) | 0.9, 1.0 | ✅ | ⏳ |
|
|
56
65
|
|
|
57
66
|
### Namespaces
|
|
58
67
|
|
|
59
|
-
| Name | Prefix | Supported in | Parsing | Generating |
|
|
60
|
-
|
|
61
|
-
| [Atom](http://www.w3.org/2005/Atom) | `<atom
|
|
62
|
-
| [Dublin Core](http://purl.org/dc/elements/1.1/) | `<dc:*>` | RSS, Atom, RDF | ✅ |
|
|
63
|
-
| [Syndication](http://purl.org/rss/1.0/modules/syndication/) | `<sy:*>` | RSS, Atom, RDF | ✅ |
|
|
64
|
-
| [Content](http://purl.org/rss/1.0/modules/content/) | `<content:*>` | RSS, RDF | ✅ |
|
|
65
|
-
| [Slash](http://purl.org/rss/1.0/modules/slash/) | `<slash:*>` | RSS, Atom, RDF | ✅ |
|
|
66
|
-
| [iTunes](http://www.itunes.com/dtds/podcast-1.0.dtd) | `<itunes:*>` | RSS, Atom | ✅ |
|
|
67
|
-
| [Podcast](https://podcastindex.org/namespace/1.0) | `<podcast:*>` | RSS | ✅ |
|
|
68
|
-
| [Media RSS](http://search.yahoo.com/mrss/) | `<media:*>` | RSS, Atom, RDF | ✅ |
|
|
69
|
-
| [GeoRSS-Simple](http://www.georss.org/georss) | `<georss:*>` | RSS, Atom, RDF | ✅ |
|
|
70
|
-
| [Atom Threading](https://www.ietf.org/rfc/rfc4685.txt) | `<thr:*>` | RSS, Atom | ✅ |
|
|
71
|
-
| [Dublin Core Terms](http://purl.org/dc/terms/) | `<dcterms:*>` |
|
|
68
|
+
| Name | Prefix[^1] | Supported in | Parsing | Generating |
|
|
69
|
+
|------|---------|--------------|---------|------------|
|
|
70
|
+
| [Atom](http://www.w3.org/2005/Atom) | `<atom:*>` | RSS, RDF | ✅ | ✅ |
|
|
71
|
+
| [Dublin Core](http://purl.org/dc/elements/1.1/) | `<dc:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
72
|
+
| [Syndication](http://purl.org/rss/1.0/modules/syndication/) | `<sy:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
73
|
+
| [Content](http://purl.org/rss/1.0/modules/content/) | `<content:*>` | RSS, RDF | ✅ | ✅ |
|
|
74
|
+
| [Slash](http://purl.org/rss/1.0/modules/slash/) | `<slash:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
75
|
+
| [iTunes](http://www.itunes.com/dtds/podcast-1.0.dtd) | `<itunes:*>` | RSS, Atom | ✅ | ✅ |
|
|
76
|
+
| [Podcast](https://podcastindex.org/namespace/1.0) | `<podcast:*>` | RSS | ✅ | ✅ |
|
|
77
|
+
| [Media RSS](http://search.yahoo.com/mrss/) | `<media:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
78
|
+
| [GeoRSS-Simple](http://www.georss.org/georss) | `<georss:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
79
|
+
| [Atom Threading](https://www.ietf.org/rfc/rfc4685.txt) | `<thr:*>` | RSS, Atom | ✅ | ✅ |
|
|
80
|
+
| [Dublin Core Terms](http://purl.org/dc/terms/) | `<dcterms:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
81
|
+
| [Well-Formed Web](http://wellformedweb.org/CommentAPI/) | `<wfw:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
82
|
+
| [YouTube](https://www.youtube.com/feeds/videos.xml) | `<yt:*>` | Atom | ✅ | ✅ |
|
|
72
83
|
| [Administrative](https://web.resource.org/rss/1.0/modules/admin/) | `<admin:*>` | 📋 | 📋 | 📋 |
|
|
73
84
|
| [GML](http://www.opengis.net/gml) | `<gml:*>` | 📋 | 📋 | 📋 |
|
|
74
85
|
| [GeoRSS GML](http://www.opengis.net/gml) | `<georss:*>` | 📋 | 📋 | 📋 |
|
|
75
86
|
|
|
87
|
+
[^1]: Custom namespace prefixes are automatically normalized to standard ones (e.g., `<custom:creator>` → `dc.creator`).
|
|
88
|
+
|
|
76
89
|
### Other
|
|
77
90
|
|
|
78
91
|
| Format | Versions | Parsing | Generating |
|
|
@@ -87,9 +100,9 @@ npm install feedsmith
|
|
|
87
100
|
|
|
88
101
|
## Parsing
|
|
89
102
|
|
|
90
|
-
### Universal
|
|
103
|
+
### Universal feed parser
|
|
91
104
|
|
|
92
|
-
The
|
|
105
|
+
The simplest way to parse any feed is to use the universal `parseFeed` function:
|
|
93
106
|
|
|
94
107
|
```ts
|
|
95
108
|
import { parseFeed } from 'feedsmith'
|
|
@@ -104,7 +117,7 @@ if (type === 'rss') {
|
|
|
104
117
|
}
|
|
105
118
|
```
|
|
106
119
|
|
|
107
|
-
### Dedicated
|
|
120
|
+
### Dedicated feed parsers
|
|
108
121
|
|
|
109
122
|
If you know the format in advance, you can use the format-specific parsers:
|
|
110
123
|
|
|
@@ -390,7 +403,7 @@ try {
|
|
|
390
403
|
|
|
391
404
|
### Format detection
|
|
392
405
|
|
|
393
|
-
You can detect feed formats without parsing them.
|
|
406
|
+
You can detect feed formats without parsing them. Detect functions are designed to quickly identify the feed format by looking for its signature, such as the the root tag, version attribute or feed elements.
|
|
394
407
|
|
|
395
408
|
```ts
|
|
396
409
|
import { detectAtomFeed, detectJsonFeed, detectRssFeed, detectRdfFeed } from 'feedsmith'
|
|
@@ -412,15 +425,184 @@ if (detectRdfFeed(content)) {
|
|
|
412
425
|
}
|
|
413
426
|
```
|
|
414
427
|
|
|
415
|
-
> [!WARNING]
|
|
416
|
-
> Detect functions are designed to quickly identify the feed format by looking for its signature, such as the `<rss>` tag in the case of RSS feeds. However, the function may detect an RSS feed even if it is invalid. The feed will be fully validated only when using the `parseRssFeed` function.
|
|
417
|
-
|
|
418
428
|
## Generating
|
|
419
429
|
|
|
430
|
+
### Generating RSS Feed
|
|
431
|
+
|
|
432
|
+
Here's an example of generating an RSS feed.
|
|
433
|
+
|
|
434
|
+
> [!NOTE]
|
|
435
|
+
> This is a simple example. For a complete list of available fields, see the [RSS type definitions](src/feeds/rss/common/types.ts).
|
|
436
|
+
|
|
437
|
+
```ts
|
|
438
|
+
import { generateRssFeed } from 'feedsmith'
|
|
439
|
+
|
|
440
|
+
const rssFeed = generateRssFeed({
|
|
441
|
+
title: 'My RSS Feed',
|
|
442
|
+
link: 'https://example.com',
|
|
443
|
+
description: 'A sample RSS feed with various elements',
|
|
444
|
+
language: 'en-US',
|
|
445
|
+
pubDate: new Date('2024-01-15T12:00:00Z'),
|
|
446
|
+
lastBuildDate: new Date('2024-01-15T12:00:00Z'),
|
|
447
|
+
generator: 'Feedsmith',
|
|
448
|
+
managingEditor: 'editor@example.com (John Editor)',
|
|
449
|
+
webMaster: 'webmaster@example.com (Jane Webmaster)',
|
|
450
|
+
items: [
|
|
451
|
+
{
|
|
452
|
+
title: 'First RSS Item',
|
|
453
|
+
link: 'https://example.com/post/1',
|
|
454
|
+
description: 'Description of the first item',
|
|
455
|
+
pubDate: new Date('2024-01-15T10:00:00Z'),
|
|
456
|
+
guid: 'https://example.com/post/1',
|
|
457
|
+
author: 'john@example.com (John Author)',
|
|
458
|
+
categories: [
|
|
459
|
+
{ name: 'Technology' },
|
|
460
|
+
{ name: 'Programming', domain: 'https://example.com/categories' }
|
|
461
|
+
],
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
})
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Will output:
|
|
468
|
+
|
|
469
|
+
```xml
|
|
470
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
471
|
+
<rss version="2.0">
|
|
472
|
+
<channel>
|
|
473
|
+
<title>My RSS Feed</title>
|
|
474
|
+
<link>https://example.com</link>
|
|
475
|
+
<description>A sample RSS feed with various elements</description>
|
|
476
|
+
<language>en-US</language>
|
|
477
|
+
<pubDate>Mon, 15 Jan 2024 12:00:00 GMT</pubDate>
|
|
478
|
+
<lastBuildDate>Mon, 15 Jan 2024 12:00:00 GMT</lastBuildDate>
|
|
479
|
+
<generator>Feedsmith</generator>
|
|
480
|
+
<managingEditor>editor@example.com (John Editor)</managingEditor>
|
|
481
|
+
<webMaster>webmaster@example.com (Jane Webmaster)</webMaster>
|
|
482
|
+
<item>
|
|
483
|
+
<title>First RSS Item</title>
|
|
484
|
+
<link>https://example.com/post/1</link>
|
|
485
|
+
<description>Description of the first item</description>
|
|
486
|
+
<pubDate>Mon, 15 Jan 2024 10:00:00 GMT</pubDate>
|
|
487
|
+
<guid>https://example.com/post/1</guid>
|
|
488
|
+
<author>john@example.com (John Author)</author>
|
|
489
|
+
<category>Technology</category>
|
|
490
|
+
<category domain="https://example.com/categories">Programming</category>
|
|
491
|
+
</item>
|
|
492
|
+
</channel>
|
|
493
|
+
</rss>
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### Generating Atom Feed
|
|
497
|
+
|
|
498
|
+
Here's an example of generating an Atom feed.
|
|
499
|
+
|
|
500
|
+
> [!NOTE]
|
|
501
|
+
> This is a simple example. For a complete list of available fields, see the [Atom type definitions](src/feeds/atom/common/types.ts).
|
|
502
|
+
|
|
503
|
+
```ts
|
|
504
|
+
import { generateAtomFeed } from 'feedsmith'
|
|
505
|
+
|
|
506
|
+
const atomFeed = generateAtomFeed({
|
|
507
|
+
id: 'https://example.com/feed',
|
|
508
|
+
title: 'My Atom Feed',
|
|
509
|
+
updated: new Date('2024-01-15T12:00:00Z'),
|
|
510
|
+
authors: [
|
|
511
|
+
{
|
|
512
|
+
name: 'John Author',
|
|
513
|
+
email: 'john@example.com',
|
|
514
|
+
uri: 'https://example.com/john',
|
|
515
|
+
},
|
|
516
|
+
],
|
|
517
|
+
links: [
|
|
518
|
+
{
|
|
519
|
+
href: 'https://example.com/feed.xml',
|
|
520
|
+
rel: 'self',
|
|
521
|
+
type: 'application/atom+xml',
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
href: 'https://example.com',
|
|
525
|
+
rel: 'alternate',
|
|
526
|
+
type: 'text/html',
|
|
527
|
+
},
|
|
528
|
+
],
|
|
529
|
+
subtitle: 'A sample Atom feed with various elements',
|
|
530
|
+
generator: {
|
|
531
|
+
text: 'Feedsmith',
|
|
532
|
+
uri: 'https://github.com/macieklamberski/feedsmith',
|
|
533
|
+
},
|
|
534
|
+
entries: [
|
|
535
|
+
{
|
|
536
|
+
id: 'https://example.com/entry/1',
|
|
537
|
+
title: 'First Atom Entry',
|
|
538
|
+
updated: new Date('2024-01-15T10:00:00Z'),
|
|
539
|
+
published: new Date('2024-01-15T10:00:00Z'),
|
|
540
|
+
authors: [
|
|
541
|
+
{
|
|
542
|
+
name: 'Jane Writer',
|
|
543
|
+
email: 'jane@example.com',
|
|
544
|
+
},
|
|
545
|
+
],
|
|
546
|
+
links: [
|
|
547
|
+
{
|
|
548
|
+
href: 'https://example.com/post/1',
|
|
549
|
+
rel: 'alternate',
|
|
550
|
+
type: 'text/html',
|
|
551
|
+
},
|
|
552
|
+
],
|
|
553
|
+
content: '<p>This is the complete content of the first entry.</p>',
|
|
554
|
+
summary: 'Summary of the first entry',
|
|
555
|
+
categories: [
|
|
556
|
+
{ term: 'technology', label: 'Technology' },
|
|
557
|
+
{ term: 'programming', scheme: 'https://example.com/categories' }
|
|
558
|
+
],
|
|
559
|
+
},
|
|
560
|
+
],
|
|
561
|
+
})
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
Will output:
|
|
565
|
+
|
|
566
|
+
```xml
|
|
567
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
568
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
569
|
+
<id>https://example.com/feed</id>
|
|
570
|
+
<title>My Atom Feed</title>
|
|
571
|
+
<updated>2024-01-15T12:00:00.000Z</updated>
|
|
572
|
+
<author>
|
|
573
|
+
<name>John Author</name>
|
|
574
|
+
<email>john@example.com</email>
|
|
575
|
+
<uri>https://example.com/john</uri>
|
|
576
|
+
</author>
|
|
577
|
+
<link href="https://example.com/feed.xml" rel="self" type="application/atom+xml"/>
|
|
578
|
+
<link href="https://example.com" rel="alternate" type="text/html"/>
|
|
579
|
+
<subtitle>A sample Atom feed with various elements</subtitle>
|
|
580
|
+
<generator uri="https://github.com/macieklamberski/feedsmith">Feedsmith</generator>
|
|
581
|
+
<entry>
|
|
582
|
+
<id>https://example.com/entry/1</id>
|
|
583
|
+
<title>First Atom Entry</title>
|
|
584
|
+
<updated>2024-01-15T10:00:00.000Z</updated>
|
|
585
|
+
<published>2024-01-15T10:00:00.000Z</published>
|
|
586
|
+
<author>
|
|
587
|
+
<name>Jane Writer</name>
|
|
588
|
+
<email>jane@example.com</email>
|
|
589
|
+
</author>
|
|
590
|
+
<link href="https://example.com/post/1" rel="alternate" type="text/html"/>
|
|
591
|
+
<content>This is the complete content of the first entry.</content>
|
|
592
|
+
<summary>Summary of the first entry</summary>
|
|
593
|
+
<category term="technology" label="Technology"/>
|
|
594
|
+
<category term="programming" scheme="https://example.com/categories"/>
|
|
595
|
+
</entry>
|
|
596
|
+
</feed>
|
|
597
|
+
```
|
|
598
|
+
|
|
420
599
|
### Generating JSON Feed
|
|
421
600
|
|
|
422
601
|
Although JSON feeds are simply JSON objects that can be easily generated manually, the `generateJsonFeed` function provides helpful type hints, which can aid in feed generation. Additionally, you can use Date objects for dates, which are automatically converted to the correct format in the background.
|
|
423
602
|
|
|
603
|
+
> [!NOTE]
|
|
604
|
+
> This is a simple example. For a complete list of available fields, see the [JSON Feed type definitions](src/feeds/json/common/types.ts).
|
|
605
|
+
|
|
424
606
|
```ts
|
|
425
607
|
import { generateJsonFeed } from 'feedsmith'
|
|
426
608
|
|
|
@@ -440,7 +622,6 @@ const jsonFeed = generateJsonFeed({
|
|
|
440
622
|
url: 'https://example.com/post/1',
|
|
441
623
|
title: 'First post',
|
|
442
624
|
date_published: new Date('2019-03-07T00:00:00+01:00'),
|
|
443
|
-
language: 'en-US',
|
|
444
625
|
},
|
|
445
626
|
],
|
|
446
627
|
})
|
|
@@ -466,17 +647,145 @@ Will output:
|
|
|
466
647
|
"url": "https://example.com/post/1",
|
|
467
648
|
"title": "First post",
|
|
468
649
|
"date_published": "2019-03-06T23:00:00.000Z",
|
|
469
|
-
"language": "en-US",
|
|
470
650
|
},
|
|
471
651
|
],
|
|
472
652
|
}
|
|
473
653
|
```
|
|
474
654
|
|
|
655
|
+
### Generating with Namespaces
|
|
656
|
+
|
|
657
|
+
RSS, Atom, and RDF feeds support various XML namespaces to extend their functionality. Feedsmith automatically includes the appropriate namespace declarations when you add namespace data to your feeds.
|
|
658
|
+
|
|
475
659
|
> [!NOTE]
|
|
476
|
-
>
|
|
660
|
+
> Namespace support varies by feed format. For complete namespace type definitions, see: [Atom](src/namespaces/atom/common/types.ts), [Content](src/namespaces/content/common/types.ts), [Dublin Core](src/namespaces/dc/common/types.ts), [DC Terms](src/namespaces/dcterms/common/types.ts), [GeoRSS](src/namespaces/georss/common/types.ts), [iTunes](src/namespaces/itunes/common/types.ts), [Media](src/namespaces/media/common/types.ts), [Podcast](src/namespaces/podcast/common/types.ts), [Slash](src/namespaces/slash/common/types.ts), [Syndication](src/namespaces/sy/common/types.ts), [Threading](src/namespaces/thr/common/types.ts), [WFW](src/namespaces/wfw/common/types.ts), [YouTube](src/namespaces/yt/common/types.ts).
|
|
661
|
+
|
|
662
|
+
Here's an example of generating an RSS feed with Dublin Core and iTunes namespaces:
|
|
663
|
+
|
|
664
|
+
```ts
|
|
665
|
+
import { generateRssFeed } from 'feedsmith'
|
|
666
|
+
|
|
667
|
+
const rssFeed = generateRssFeed({
|
|
668
|
+
title: 'My Podcast Feed',
|
|
669
|
+
link: 'https://example.com/podcast',
|
|
670
|
+
description: 'A sample podcast with namespace elements',
|
|
671
|
+
dc: {
|
|
672
|
+
creator: 'John Podcaster',
|
|
673
|
+
contributor: 'Jane Producer',
|
|
674
|
+
date: new Date('2024-01-15T12:00:00Z'),
|
|
675
|
+
language: 'en-US',
|
|
676
|
+
},
|
|
677
|
+
itunes: {
|
|
678
|
+
author: 'John Podcaster',
|
|
679
|
+
category: [
|
|
680
|
+
{ text: 'Technology' },
|
|
681
|
+
{ text: 'Education', subcategory: [{ text: 'Courses' }] }
|
|
682
|
+
],
|
|
683
|
+
explicit: false,
|
|
684
|
+
image: { href: 'https://example.com/artwork.jpg' },
|
|
685
|
+
summary: 'A technology podcast for curious minds',
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
items: [
|
|
689
|
+
{
|
|
690
|
+
title: 'Episode 1: Getting Started',
|
|
691
|
+
link: 'https://example.com/episode1',
|
|
692
|
+
description: 'Our first episode covers the basics',
|
|
693
|
+
pubDate: new Date('2024-01-15T10:00:00Z'),
|
|
694
|
+
dc: {
|
|
695
|
+
creator: 'Jane Producer',
|
|
696
|
+
subject: 'Technology, Programming',
|
|
697
|
+
},
|
|
698
|
+
itunes: {
|
|
699
|
+
author: 'Jane Producer',
|
|
700
|
+
duration: '00:45:30',
|
|
701
|
+
explicit: false,
|
|
702
|
+
episode: 1,
|
|
703
|
+
episodeType: 'full',
|
|
704
|
+
},
|
|
705
|
+
},
|
|
706
|
+
],
|
|
707
|
+
})
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
Will output:
|
|
711
|
+
|
|
712
|
+
```xml
|
|
713
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
714
|
+
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
|
|
715
|
+
<channel>
|
|
716
|
+
<title>My Podcast Feed</title>
|
|
717
|
+
<link>https://example.com/podcast</link>
|
|
718
|
+
<description>A sample podcast with namespace elements</description>
|
|
719
|
+
<dc:creator>John Podcaster</dc:creator>
|
|
720
|
+
<dc:contributor>Jane Producer</dc:contributor>
|
|
721
|
+
<dc:date>Mon, 15 Jan 2024 12:00:00 GMT</dc:date>
|
|
722
|
+
<dc:language>en-US</dc:language>
|
|
723
|
+
<itunes:author>John Podcaster</itunes:author>
|
|
724
|
+
<itunes:category text="Technology"/>
|
|
725
|
+
<itunes:category text="Education">
|
|
726
|
+
<itunes:category text="Courses"/>
|
|
727
|
+
</itunes:category>
|
|
728
|
+
<itunes:explicit>false</itunes:explicit>
|
|
729
|
+
<itunes:image href="https://example.com/artwork.jpg"/>
|
|
730
|
+
<itunes:summary>A technology podcast for curious minds</itunes:summary>
|
|
731
|
+
<item>
|
|
732
|
+
<title>Episode 1: Getting Started</title>
|
|
733
|
+
<link>https://example.com/episode1</link>
|
|
734
|
+
<description>Our first episode covers the basics</description>
|
|
735
|
+
<pubDate>Mon, 15 Jan 2024 10:00:00 GMT</pubDate>
|
|
736
|
+
<dc:creator>Jane Producer</dc:creator>
|
|
737
|
+
<dc:subject>Technology, Programming</dc:subject>
|
|
738
|
+
<itunes:author>Jane Producer</itunes:author>
|
|
739
|
+
<itunes:duration>00:45:30</itunes:duration>
|
|
740
|
+
<itunes:explicit>false</itunes:explicit>
|
|
741
|
+
<itunes:episode>1</itunes:episode>
|
|
742
|
+
<itunes:episodeType>full</itunes:episodeType>
|
|
743
|
+
</item>
|
|
744
|
+
</channel>
|
|
745
|
+
</rss>
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
### Generating with Stylesheets
|
|
749
|
+
|
|
750
|
+
XML-based feeds and OPML files support stylesheets to provide custom styling and transformations in browsers and feed readers. Feedsmith automatically adds the appropriate XML processing instructions when you specify stylesheets. For complete stylesheet type definitions, see [`XmlStylesheet` type](src/common/types.ts).
|
|
751
|
+
|
|
752
|
+
```ts
|
|
753
|
+
import { generateRssFeed } from 'feedsmith'
|
|
754
|
+
|
|
755
|
+
const rssFeed = generateRssFeed({ /* feed data */ }, {
|
|
756
|
+
stylesheets: [
|
|
757
|
+
{
|
|
758
|
+
type: 'text/xsl',
|
|
759
|
+
href: '/styles/feed.xsl',
|
|
760
|
+
title: 'Pretty Feed',
|
|
761
|
+
media: 'screen',
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
type: 'text/css',
|
|
765
|
+
href: '/styles/feed.css',
|
|
766
|
+
media: 'screen',
|
|
767
|
+
alternate: false,
|
|
768
|
+
},
|
|
769
|
+
],
|
|
770
|
+
})
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
Will output:
|
|
774
|
+
|
|
775
|
+
```xml
|
|
776
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
777
|
+
<?xml-stylesheet type="text/xsl" href="/styles/feed.xsl" title="Pretty Feed" media="screen"?>
|
|
778
|
+
<?xml-stylesheet type="text/css" href="/styles/feed.css" media="screen" alternate="no"?>
|
|
779
|
+
<rss version="2.0">
|
|
780
|
+
<!-- … -->
|
|
781
|
+
</rss>
|
|
782
|
+
```
|
|
477
783
|
|
|
478
784
|
### Generating OPML
|
|
479
785
|
|
|
786
|
+
> [!NOTE]
|
|
787
|
+
> This is a simple example. For a complete list of available fields, see the [OPML type definitions](src/opml/common/types.ts).
|
|
788
|
+
|
|
480
789
|
```ts
|
|
481
790
|
import { generateOpml } from 'feedsmith'
|
|
482
791
|
|
|
@@ -522,45 +831,46 @@ A comprehensive set of benchmarks, categorized by various file sizes, is availab
|
|
|
522
831
|
For a quick overview, here are the results of parsing RSS, Atom, and RDF feeds using various JS packages with Tinybench. Feedsmith's results are marked with an asterisk (`*`).
|
|
523
832
|
|
|
524
833
|
```
|
|
525
|
-
📊 RSS feed parsing (
|
|
526
|
-
|
|
527
|
-
│ │ Package │ Ops/sec │ Average (ms) │ Min (ms) │ Max (ms) │ Runs │
|
|
528
|
-
|
|
529
|
-
│ 0 │ feedsmith * │
|
|
530
|
-
│ 1 │ @
|
|
531
|
-
│ 2 │ @
|
|
532
|
-
│ 3 │
|
|
533
|
-
│ 4 │
|
|
534
|
-
│ 5 │
|
|
535
|
-
│ 6 │
|
|
536
|
-
│ 7 │
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
│
|
|
545
|
-
│
|
|
546
|
-
│
|
|
547
|
-
│
|
|
548
|
-
│
|
|
549
|
-
│
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
│
|
|
558
|
-
│
|
|
559
|
-
│
|
|
560
|
-
│
|
|
561
|
-
│
|
|
562
|
-
│
|
|
563
|
-
|
|
834
|
+
📊 RSS feed parsing (100 files × 100KB–5MB)
|
|
835
|
+
┌───┬───────────────────────────────┬─────────┬──────────────┬──────────┬──────────┬──────┬─────────────┐
|
|
836
|
+
│ │ Package │ Ops/sec │ Average (ms) │ Min (ms) │ Max (ms) │ Runs │ Performance │
|
|
837
|
+
├───┼───────────────────────────────┼─────────┼──────────────┼──────────┼──────────┼──────┼─────────────┤
|
|
838
|
+
│ 0 │ feedsmith * │ 2.15 │ 464.233 │ 431.238 │ 560.196 │ 33 │ baseline │
|
|
839
|
+
│ 1 │ @ulisesgascon/rss-feed-parser │ 1.61 │ 619.751 │ 583.357 │ 702.199 │ 25 │ 1.3x slower │
|
|
840
|
+
│ 2 │ @gaphub/feed │ 1.51 │ 663.333 │ 615.706 │ 753.343 │ 23 │ 1.4x slower │
|
|
841
|
+
│ 3 │ podcast-feed-parser │ 1.40 │ 713.043 │ 663.199 │ 822.646 │ 22 │ 1.5x slower │
|
|
842
|
+
│ 4 │ feedparser │ 0.99 │ 1013.059 │ 943.120 │ 1140.454 │ 15 │ 2.2x slower │
|
|
843
|
+
│ 5 │ @extractus/feed-extractor │ 0.86 │ 1167.174 │ 1105.055 │ 1266.003 │ 13 │ 2.5x slower │
|
|
844
|
+
│ 6 │ feedme.js │ 0.74 │ 1347.627 │ 1192.642 │ 1633.812 │ 12 │ 2.9x slower │
|
|
845
|
+
│ 7 │ rss-parser │ 0.64 │ 1551.783 │ 1495.036 │ 1739.777 │ 10 │ 3.3x slower │
|
|
846
|
+
│ 8 │ @rowanmanning/feed-parser │ 0.46 │ 2186.174 │ 2029.103 │ 2689.577 │ 7 │ 4.7x slower │
|
|
847
|
+
└───┴───────────────────────────────┴─────────┴──────────────┴──────────┴──────────┴──────┴─────────────┘
|
|
848
|
+
|
|
849
|
+
📊 Atom feed parsing (100 files × 100KB–5MB)
|
|
850
|
+
┌───┬───────────────────────────┬─────────┬──────────────┬───────────┬───────────┬──────┬─────────────┐
|
|
851
|
+
│ │ Package │ Ops/sec │ Average (ms) │ Min (ms) │ Max (ms) │ Runs │ Performance │
|
|
852
|
+
├───┼───────────────────────────┼─────────┼──────────────┼───────────┼───────────┼──────┼─────────────┤
|
|
853
|
+
│ 0 │ feedsmith * │ 0.45 │ 2218.248 │ 2195.860 │ 2258.982 │ 7 │ baseline │
|
|
854
|
+
│ 1 │ @rowanmanning/feed-parser │ 0.18 │ 5553.175 │ 5249.846 │ 5861.476 │ 3 │ 2.5x slower │
|
|
855
|
+
│ 2 │ feedparser │ 0.17 │ 6057.445 │ 5563.861 │ 6781.359 │ 3 │ 2.7x slower │
|
|
856
|
+
│ 3 │ @extractus/feed-extractor │ 0.15 │ 6685.829 │ 6494.192 │ 6984.887 │ 3 │ 3.0x slower │
|
|
857
|
+
│ 4 │ @gaphub/feed │ 0.13 │ 7717.126 │ 6402.034 │ 9032.219 │ 2 │ 3.5x slower │
|
|
858
|
+
│ 5 │ feedme.js │ 0.12 │ 8053.625 │ 7935.369 │ 8171.881 │ 2 │ 3.6x slower │
|
|
859
|
+
│ 6 │ rss-parser │ 0.08 │ 12999.252 │ 12819.434 │ 13179.070 │ 2 │ 5.9x slower │
|
|
860
|
+
└───┴───────────────────────────┴─────────┴──────────────┴───────────┴───────────┴──────┴─────────────┘
|
|
861
|
+
|
|
862
|
+
📊 RDF feed parsing (100 files × 100KB–5MB)
|
|
863
|
+
┌───┬───────────────────────────┬─────────┬──────────────┬──────────┬──────────┬──────┬──────────────┐
|
|
864
|
+
│ │ Package │ Ops/sec │ Average (ms) │ Min (ms) │ Max (ms) │ Runs │ Performance │
|
|
865
|
+
├───┼───────────────────────────┼─────────┼──────────────┼──────────┼──────────┼──────┼──────────────┤
|
|
866
|
+
│ 0 │ feedsmith * │ 5.93 │ 168.678 │ 153.476 │ 191.892 │ 89 │ baseline │
|
|
867
|
+
│ 1 │ @rowanmanning/feed-parser │ 3.00 │ 333.512 │ 312.475 │ 387.156 │ 45 │ 2.0x slower │
|
|
868
|
+
│ 2 │ @extractus/feed-extractor │ 1.80 │ 556.240 │ 504.258 │ 621.485 │ 27 │ 3.3x slower │
|
|
869
|
+
│ 3 │ @gaphub/feed │ 1.23 │ 815.776 │ 729.150 │ 1129.571 │ 19 │ 4.8x slower │
|
|
870
|
+
│ 4 │ feedparser │ 0.92 │ 1087.980 │ 1023.638 │ 1128.518 │ 14 │ 6.5x slower │
|
|
871
|
+
│ 5 │ feedme.js │ 0.64 │ 1567.422 │ 1506.713 │ 1626.450 │ 10 │ 9.3x slower │
|
|
872
|
+
│ 6 │ rss-parser │ 0.42 │ 2368.398 │ 2288.041 │ 2438.408 │ 7 │ 14.0x slower │
|
|
873
|
+
└───┴───────────────────────────┴─────────┴──────────────┴──────────┴──────────┴──────┴──────────────┘
|
|
564
874
|
```
|
|
565
875
|
|
|
566
876
|
## FAQ
|
package/dist/common/config.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import type { X2jOptions } from 'fast-xml-parser';
|
|
1
|
+
import type { X2jOptions, XmlBuilderOptions } from 'fast-xml-parser';
|
|
2
2
|
export declare const parserConfig: X2jOptions;
|
|
3
|
+
export declare const builderConfig: XmlBuilderOptions;
|
|
3
4
|
export declare const locales: {
|
|
4
5
|
unrecognized: string;
|
|
5
6
|
invalid: string;
|
|
6
7
|
};
|
|
8
|
+
export declare const namespaceUrls: {
|
|
9
|
+
atom: string;
|
|
10
|
+
content: string;
|
|
11
|
+
dc: string;
|
|
12
|
+
dcterms: string;
|
|
13
|
+
georss: string;
|
|
14
|
+
itunes: string;
|
|
15
|
+
media: string;
|
|
16
|
+
podcast: string;
|
|
17
|
+
rdf: string;
|
|
18
|
+
slash: string;
|
|
19
|
+
sy: string;
|
|
20
|
+
thr: string;
|
|
21
|
+
wfw: string;
|
|
22
|
+
yt: string;
|
|
23
|
+
};
|
package/dist/common/config.js
CHANGED
|
@@ -12,8 +12,33 @@ export const parserConfig = {
|
|
|
12
12
|
transformTagName: (name) => name.toLowerCase(),
|
|
13
13
|
transformAttributeName: (name) => name.toLowerCase(),
|
|
14
14
|
};
|
|
15
|
+
export const builderConfig = {
|
|
16
|
+
processEntities: true,
|
|
17
|
+
ignoreAttributes: false,
|
|
18
|
+
suppressEmptyNode: true,
|
|
19
|
+
suppressBooleanAttributes: false,
|
|
20
|
+
attributeNamePrefix: '@',
|
|
21
|
+
format: true,
|
|
22
|
+
cdataPropName: '#cdata',
|
|
23
|
+
};
|
|
15
24
|
export const locales = {
|
|
16
25
|
unrecognized: 'Unrecognized feed format',
|
|
17
26
|
invalid: 'Invalid feed format',
|
|
18
27
|
};
|
|
28
|
+
export const namespaceUrls = {
|
|
29
|
+
atom: 'http://www.w3.org/2005/Atom',
|
|
30
|
+
content: 'http://purl.org/rss/1.0/modules/content/',
|
|
31
|
+
dc: 'http://purl.org/dc/elements/1.1/',
|
|
32
|
+
dcterms: 'http://purl.org/dc/terms/',
|
|
33
|
+
georss: 'http://www.georss.org/georss/',
|
|
34
|
+
itunes: 'http://www.itunes.com/dtds/podcast-1.0.dtd',
|
|
35
|
+
media: 'http://search.yahoo.com/mrss/',
|
|
36
|
+
podcast: 'https://podcastindex.org/namespace/1.0',
|
|
37
|
+
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
38
|
+
slash: 'http://purl.org/rss/1.0/modules/slash/',
|
|
39
|
+
sy: 'http://purl.org/rss/1.0/modules/syndication/',
|
|
40
|
+
thr: 'http://purl.org/syndication/thread/1.0',
|
|
41
|
+
wfw: 'http://wellformedweb.org/CommentAPI/',
|
|
42
|
+
yt: 'http://www.youtube.com/xml/schemas/2015',
|
|
43
|
+
};
|
|
19
44
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/common/config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAe;IACtC,UAAU,EAAE,KAAK;IACjB,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,KAAK;IAC1B,oBAAoB,EAAE,KAAK;IAC3B,gBAAgB,EAAE,KAAK;IACvB,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,IAAI;IACvB,mBAAmB,EAAE,GAAG;IACxB,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;IAC9C,sBAAsB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;CACrD,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,YAAY,EAAE,0BAA0B;IACxC,OAAO,EAAE,qBAAqB;CAC/B,CAAA"}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/common/config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAe;IACtC,UAAU,EAAE,KAAK;IACjB,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,KAAK;IAC1B,oBAAoB,EAAE,KAAK;IAC3B,gBAAgB,EAAE,KAAK;IACvB,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,IAAI;IACvB,mBAAmB,EAAE,GAAG;IACxB,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;IAC9C,sBAAsB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;CACrD,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,IAAI;IACvB,yBAAyB,EAAE,KAAK;IAChC,mBAAmB,EAAE,GAAG;IACxB,MAAM,EAAE,IAAI;IACZ,aAAa,EAAE,QAAQ;CACxB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,YAAY,EAAE,0BAA0B;IACxC,OAAO,EAAE,qBAAqB;CAC/B,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,6BAA6B;IACnC,OAAO,EAAE,0CAA0C;IACnD,EAAE,EAAE,kCAAkC;IACtC,OAAO,EAAE,2BAA2B;IACpC,MAAM,EAAE,+BAA+B;IACvC,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,+BAA+B;IACtC,OAAO,EAAE,wCAAwC;IACjD,GAAG,EAAE,6CAA6C;IAClD,KAAK,EAAE,wCAAwC;IAC/C,EAAE,EAAE,8CAA8C;IAClD,GAAG,EAAE,wCAAwC;IAC7C,GAAG,EAAE,sCAAsC;IAC3C,EAAE,EAAE,yCAAyC;CAC9C,CAAA"}
|