diff --git a/index.d.ts b/index.d.ts
index 45b237a..21ed94d 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -59,6 +59,7 @@ declare namespace Parser {
items: (U & Item)[];
feedUrl?: string;
description?: string;
+ subtitle?: string;
itunes?: {
[key: string]: any;
image?: string;
diff --git a/lib/fields.js b/lib/fields.js
index b3f8d7b..f3df0ef 100644
--- a/lib/fields.js
+++ b/lib/fields.js
@@ -9,6 +9,7 @@ fields.feed = [
['dc:type', 'type'],
'title',
'description',
+ 'subtitle',
'author',
'pubDate',
'webMaster',
diff --git a/lib/parser.js b/lib/parser.js
index 6aaccb0..214d4fb 100644
--- a/lib/parser.js
+++ b/lib/parser.js
@@ -145,6 +145,11 @@ class Parser {
if (title._) title = title._
if (title) feed.title = title;
}
+ if (xmlObj.feed.subtitle) {
+ let subtitle = xmlObj.feed.subtitle[0] || '';
+ if (subtitle._) subtitle = subtitle._;
+ if (subtitle) feed.subtitle = subtitle;
+ }
if (xmlObj.feed.updated) {
feed.lastBuildDate = xmlObj.feed.updated[0];
}
diff --git a/test/input/subtitle-atom.atom b/test/input/subtitle-atom.atom
new file mode 100644
index 0000000..95092db
--- /dev/null
+++ b/test/input/subtitle-atom.atom
@@ -0,0 +1,19 @@
+
+
+ urn:uuid:test-feed-subtitle
+ Test Feed with Subtitle
+ This is the feed subtitle
+ 2024-01-01T00:00:00Z
+
+
+
+ Test Author
+
+
+ urn:uuid:test-entry-1
+ Test Entry
+
+ 2024-01-01T00:00:00Z
+ This is a test entry
+
+
diff --git a/test/input/subtitle.rss b/test/input/subtitle.rss
new file mode 100644
index 0000000..c1ece3b
--- /dev/null
+++ b/test/input/subtitle.rss
@@ -0,0 +1,15 @@
+
+
+
+ Test Feed with Subtitle
+ http://example.com
+ This is the feed description
+ This is the feed subtitle
+ -
+ Test Entry
+ http://example.com/entry1
+ This is a test entry
+ Mon, 01 Jan 2024 00:00:00 GMT
+
+
+
diff --git a/test/output/feedburner.json b/test/output/feedburner.json
index d21642c..28067e4 100644
--- a/test/output/feedburner.json
+++ b/test/output/feedburner.json
@@ -255,6 +255,7 @@
"link": "http://googleadsdeveloper.blogspot.com/search/label/adwords_api",
"feedUrl": "http://www.blogger.com/feeds/7815614485808579332/posts/default/-/adwords_api/-/adwords_api?start-index=26&max-results=25",
"title": "Google Ads Developer Blog",
+ "subtitle": "The official blog for information about the AdWords, AdSense, DoubleClick and AdMob APIs and SDKs.",
"lastBuildDate": "2016-06-27T07:36:54.007-07:00"
}
}
\ No newline at end of file
diff --git a/test/output/heise.json b/test/output/heise.json
index 79e1fed..f04770e 100644
--- a/test/output/heise.json
+++ b/test/output/heise.json
@@ -155,6 +155,7 @@
"link": "http://www.heise.de/developer/",
"feedUrl": "http://www.heise.de/developer/rss/news-atom.xml",
"title": "heise developer neueste Meldungen",
+ "subtitle": "Informationen für Entwickler",
"lastBuildDate": "2016-02-01T17:54:50+01:00"
}
}
\ No newline at end of file
diff --git a/test/output/many-links.json b/test/output/many-links.json
index cd5cc5f..6c5366d 100644
--- a/test/output/many-links.json
+++ b/test/output/many-links.json
@@ -255,6 +255,7 @@
"link": "http://testing.googleblog.com/",
"feedUrl": "http://www.blogger.com/feeds/15045980/posts/default?start-index=26&max-results=25&redirect=false",
"title": "Google Testing Blog",
+ "subtitle": "If it ain't broke, you're not trying hard enough.",
"lastBuildDate": "2017-10-18T03:40:38.732-07:00"
}
}
\ No newline at end of file
diff --git a/test/output/subtitle-atom.json b/test/output/subtitle-atom.json
new file mode 100644
index 0000000..ddd2973
--- /dev/null
+++ b/test/output/subtitle-atom.json
@@ -0,0 +1,19 @@
+{
+ "feed": {
+ "items": [
+ {
+ "title": "Test Entry",
+ "link": "http://example.com/entry1",
+ "pubDate": "2024-01-01T00:00:00.000Z",
+ "summary": "This is a test entry",
+ "id": "urn:uuid:test-entry-1",
+ "isoDate": "2024-01-01T00:00:00.000Z"
+ }
+ ],
+ "link": "http://example.com",
+ "feedUrl": "http://example.com/feed",
+ "title": "Test Feed with Subtitle",
+ "subtitle": "This is the feed subtitle",
+ "lastBuildDate": "2024-01-01T00:00:00Z"
+ }
+}
diff --git a/test/output/subtitle.json b/test/output/subtitle.json
new file mode 100644
index 0000000..bff9c41
--- /dev/null
+++ b/test/output/subtitle.json
@@ -0,0 +1,18 @@
+{
+ "feed": {
+ "items": [
+ {
+ "title": "Test Entry",
+ "link": "http://example.com/entry1",
+ "pubDate": "Mon, 01 Jan 2024 00:00:00 GMT",
+ "content": "This is a test entry",
+ "contentSnippet": "This is a test entry",
+ "isoDate": "2024-01-01T00:00:00.000Z"
+ }
+ ],
+ "title": "Test Feed with Subtitle",
+ "description": "This is the feed description",
+ "subtitle": "This is the feed subtitle",
+ "link": "http://example.com"
+ }
+}
diff --git a/test/parser.js b/test/parser.js
index 034c72f..1d4ec85 100644
--- a/test/parser.js
+++ b/test/parser.js
@@ -284,4 +284,12 @@ describe('Parser', function() {
it('should parse atom:link pagination links', function (done) {
testParseForFile('pagination-links', 'rss', done);
});
+
+ it('should parse subtitle from RSS feed', function(done) {
+ testParseForFile('subtitle', 'rss', done);
+ });
+
+ it('should parse subtitle from Atom feed', function(done) {
+ testParseForFile('subtitle-atom', 'atom', done);
+ });
})