SFEEDRC(5)

NAME
sfeedrc - sfeed_update(1) configuration file

DESCRIPTION
sfeedrc is the configuration file for sfeed_update(1).

VARIABLES

sfeedpath
    can be set for the directory to store the TAB-separated feed files. The default is $HOME/.sfeed/feeds.

maxjobs
    can be used to change the amount of concurrent feed() jobs. The default is 8.

FUNCTIONS

feeds()
    This function is the required "main" entry-point function called from sfeed_update(1).

feed(name, feedurl, basesiteurl, encoding)
    Inside the feeds() function feeds can be defined by calling the feed() function, its arguments are:

    name
        Name of the feed, this is also used as the filename for the TAB-separated feed file. The feed name cannot contain the '/' character because it is a path separator, they will be replaced with '_'.

    feedurl
        URL to fetch the RSS/Atom data from, usually a HTTP or HTTPS URL.

    [basesiteurl]
        Base URL of the feed links. This argument allows to fix relative item links.

        According to the RSS and Atom specification feeds should always have absolute URLs, however this is not always the case in practise.

    [encoding]
        Feeds are decoded from this name to UTF-8, the name should be a usable character-set for the iconv(1) tool.

OVERRIDE FUNCTIONS
Because sfeed_update(1) is a shellscript each function can be overridden to change its behaviour, notable functions are:

fetch(name, url, feedfile)
    Fetch feed from URL and writes data to stdout, its arguments are:

    name
        Specified name in configuration file (useful for logging).

    url Url to fetch.

    feedfile
        Used feedfile (useful for comparing modification times).

    By default the tool curl(1) is used.

convertencoding(name, from, to)
    Convert from text-encoding to another and writes it to stdout, its arguments are:

    name
        Feed name.

    from
        From text-encoding.

    to  To text-encoding.

    By default the tool iconv(1) is used.

parse(name, feedurl, basesiteurl)
    Parse and convert RSS/Atom XML to the sfeed(5) TSV format.

    name
        Name of the feed.

    feedurl
        URL of the feed.

    basesiteurl
        Base URL of the feed links. This argument allows to fix relative item links.

filter(name)
    Filter sfeed(5) data from stdin, write to stdout, its arguments are:

    name
        Feed name.

merge(name, oldfile, newfile)
    Merge data of oldfile with newfile and writes it to stdout, its arguments are:

    name
        Feed name.

    oldfile
        Old file.

    newfile
        New file.

order(name)
    Sort sfeed(5) data from stdin, write to stdout, its arguments are:

    name
        Feed name.

EXAMPLES
An example configuration file is included named sfeedrc.example and also shown below:

    #sfeedpath="$HOME/.sfeed/feeds"
    # list of feeds to fetch:
    feeds() {
    	# feed <name> <feedurl> [basesiteurl] [encoding]
    	feed "codemadness" "https://www.codemadness.org/atom_content.xml"
    	feed "explosm" "http://feeds.feedburner.com/Explosm"
    	feed "golang github releases" "https://github.com/golang/go/releases.atom"
    	feed "linux kernel" "https://www.kernel.org/feeds/kdist.xml" "https://www.kernel.org"
    	feed "reddit openbsd" "https://old.reddit.com/r/openbsd/.rss"
    	feed "slashdot" "http://rss.slashdot.org/Slashdot/slashdot" "http://slashdot.org"
    	feed "tweakers" "http://feeds.feedburner.com/tweakers/mixed" "http://tweakers.net" "iso-8859-1"
    	# get youtube Atom feed: curl -s -L 'https://www.youtube.com/user/gocoding/videos' | sfeed_web | cut -f 1
    	feed "youtube golang" "https://www.youtube.com/feeds/videos.xml?channel_id=UCO3LEtymiLrgvpb59cNsb8A"
    	feed "xkcd" "https://xkcd.com/atom.xml" "https://xkcd.com"
    }

To change the default curl(1) options for fetching the data, the fetch() function can be overridden and added at the top of the sfeedrc file:

    # fetch(name, url, feedfile)
    fetch() {
    	# allow for 1 redirect, hide User-Agent, timeout is 15 seconds.
    	curl -L --max-redirs 1 -H "User-Agent:" -f -s -m 15 \
    		"$2" 2>/dev/null
    }

SEE ALSO
curl(1), iconv(1), sfeed_update(1), sh(1)

AUTHORS
Hiltjo Posthuma <hiltjo@codemadness.org>