sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit 1a17ad48876172fadb6782f1edee2058819770dc
parent 650adaf537c2baea0d8ad1d11d16286c798cd640
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon, 25 Jan 2021 19:27:04 +0100

sfeed_update: add an overridable parse() function, using sfeed(1) by default

This can be useful to make more cleanly make connector scripts.
This does not necesarily even have to be in the sfeed(5) format.

Diffstat:
Msfeed_update | 8+++++++-
Msfeedrc.5 | 15++++++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/sfeed_update b/sfeed_update @@ -55,6 +55,12 @@ convertencoding() { fi } +# parse and convert input, by default XML to the sfeed(5) TSV format. +# parse(name, feedurl, basesiteurl) +parse() { + sfeed "$3" +} + # filter fields. # filter(name) filter() { @@ -115,7 +121,7 @@ feed() { fi rm -f "${tmpfeedfile}.fetch" - if ! sfeed "${basesiteurl}" < "${tmpfeedfile}.utf8" > "${tmpfeedfile}.tsv"; then + if ! parse "${name}" "${feedurl}" "${basesiteurl}" < "${tmpfeedfile}.utf8" > "${tmpfeedfile}.tsv"; then log "${name}" "FAIL (CONVERT)" return fi diff --git a/sfeedrc.5 b/sfeedrc.5 @@ -1,4 +1,4 @@ -.Dd January 11, 2021 +.Dd January 24, 2021 .Dt SFEEDRC 5 .Os .Sh NAME @@ -86,6 +86,19 @@ To text-encoding. By default the tool .Xr iconv 1 is used. +.It Fn parse "name" "feedurl" "basesiteurl" +Parse and convert RSS/Atom XML to the +.Xr sfeed 5 +TSV format. +.Bl -tag -width Ds +.It Fa name +Name of the feed. +.It Fa feedurl +Url of the feed. +.It Fa basesiteurl +Baseurl of the feed links. +This argument allows to fix relative item links. +.El .It Fn filter "name" Filter .Xr sfeed 5