sfeed

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

commit 8002e2c0dfb757b8c73531e1e5f36415c5c9031b
parent 6341524d8587aba6b647de9798941aa9e6db6cfc
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue, 30 Apr 2019 00:33:53 +0200

improve README

- add preface text.
- use "\t" pattern for awk (easier to read and copy-paste).
- add a small example to get the most recent enclosure.

Diffstat:
MREADME | 29+++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/README b/README @@ -3,6 +3,12 @@ sfeed RSS and Atom parser (and some format programs). +It converts RSS or Atom feeds from XML to a TAB-separated file. +There are format programs included to format this TAB-separated format to +various other formats. +There are also some programs and scripts included to import and export OPML and +to update, sort, filter and merge feed items. + Build and install ----------------- @@ -240,7 +246,7 @@ advertisements, strip tracking parameters and more. filter() { case "$1" in "tweakers") - LC_LOCALE=C awk -F ' ' 'BEGIN { OFS = " "; } + LC_LOCALE=C awk -F '\t' 'BEGIN { OFS = "\t"; } # skip ads. $2 ~ /^ADV:/ { next; @@ -254,14 +260,14 @@ filter() { }';; "yt BSDNow") # filter only BSD Now from channel. - LC_LOCALE=C awk -F ' ' '$2 ~ / \| BSD Now/';; + LC_LOCALE=C awk -F '\t' '$2 ~ / \| BSD Now/';; *) cat;; esac | \ # replace youtube links with embed links. sed 's@www.youtube.com/watch?v=@www.youtube.com/embed/@g' | \ - LC_LOCALE=C awk -F ' ' 'BEGIN { OFS = " "; } + LC_LOCALE=C awk -F '\t' 'BEGIN { OFS = "\t"; } function filterlink(s) { # protocol must start with http, https or gopher. if (match(s, /^(http|https|gopher):\/\//) == 0) { @@ -312,7 +318,7 @@ to an Atom XML feed (again): #!/bin/sh cd ~/.sfeed/feeds/ || exit 1 -LC_ALL=C awk -F ' ' -v "old=$(($(date -j +'%s') - 86400))" ' +LC_ALL=C awk -F '\t' -v "old=$(($(date -j +'%s') - 86400))" ' BEGIN { OFS = "\t"; } @@ -327,6 +333,21 @@ sfeed_atom - - - +For some podcast feed the following code can be used to filter the latest +enclosure url (probably some audio file): + +LC_ALL=C awk -F "\t" 'BEGIN { latest = 0; } +length($8) { + ts = int($1); + if (ts > latest) { + url = $8; + latest = ts; + } +} +END { if (length(url)) { print url; } }' + +- - - + Over time your feeds file might become quite big. You can archive items from a specific date by doing for example: