sfeed

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

commit 3d53648620178dc30ec8d8b459f786344082b1aa
parent b50c0f5b36e9b88367bacb6ca44f4791b8f7eebc
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon,  5 Jan 2015 15:19:26 +0100

sfeed: prefer updated timestamp over published for Atom

Diffstat:
Msfeed.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sfeed.c b/sfeed.c @@ -641,12 +641,16 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) string_clear(ctx.field); } else if(ctx.item.feedtype == FeedTypeAtom) { if(ctx.tagid == AtomTagPublished || ctx.tagid == AtomTagUpdated) { - ctx.field = &ctx.item.timestamp; + /* ignore, prefer updated over published */ + if(ctx.tagid != AtomTagPublished || !ctx.item.timestamp.len) { + ctx.field = &ctx.item.timestamp; + return; + } } else if(ctx.tagid == AtomTagTitle) { ctx.field = &ctx.item.title; } else if(ctx.tagid == AtomTagSummary || ctx.tagid == AtomTagContent) { /* ignore, prefer content:encoded over description */ - if(!(ctx.tagid == AtomTagSummary && ctx.item.content.len)) { + if(ctx.tagid != AtomTagSummary || !ctx.item.content.len) { ctx.iscontenttag = 1; ctx.field = &ctx.item.content; return;