sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 789cc616a95f8ab841df5a007cf1115f9d63117f
parent bb3aa63579c2282db6234fcc95b0f7ed7d71cd25
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed, 21 Apr 2021 12:47:46 +0200

add support for old/legacy Atom 0.3 feeds

This standard was a draft used around 2005-2006.

Instead of the fields "published" and "updated" it used "issued" (mandatory
field) and "modified" (optional). Add support for them and also in preference
of supporting Atom 1.0 and creation dates first.

I don't know any real-life examples that still use this though.

Some references:
- http://rakaz.nl/2005/07/moving-from-atom-03-to-10.html
- https://www.dokuwiki.org/syndication (rss_type "atom" parameter value).
- https://support.google.com/merchants/answer/160598?hl=en

Diffstat:
Msfeed.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sfeed.c b/sfeed.c @@ -58,7 +58,8 @@ enum TagId { RSSTagAuthor, RSSTagDccreator, RSSTagCategory, /* Atom */ - AtomTagUpdated, AtomTagPublished, /* creation date has higher priority */ + /* creation date has higher priority */ + AtomTagModified, AtomTagUpdated, AtomTagIssued, AtomTagPublished, AtomTagTitle, AtomTagMediaDescription, AtomTagSummary, AtomTagContent, AtomTagId, @@ -151,9 +152,11 @@ static FeedTag atomtags[] = { { STRP("category"), AtomTagCategory }, { STRP("content"), AtomTagContent }, { STRP("id"), AtomTagId }, + { STRP("issued"), AtomTagIssued }, /* Atom 0.3 */ /* Atom: <link href="" />, RSS has <link></link> */ { STRP("link"), AtomTagLink }, { STRP("media:description"), AtomTagMediaDescription }, + { STRP("modified"), AtomTagModified }, /* Atom 0.3 */ { STRP("published"), AtomTagPublished }, { STRP("summary"), AtomTagSummary }, { STRP("title"), AtomTagTitle }, @@ -186,7 +189,9 @@ static int fieldmap[TagLast] = { [RSSTagDccreator] = FeedFieldAuthor, [RSSTagCategory] = FeedFieldCategory, /* Atom */ + [AtomTagModified] = FeedFieldTime, [AtomTagUpdated] = FeedFieldTime, + [AtomTagIssued] = FeedFieldTime, [AtomTagPublished] = FeedFieldTime, [AtomTagTitle] = FeedFieldTitle, [AtomTagMediaDescription] = FeedFieldContent,