RSS for dummies, straight forward guide to Sfeed

2021-03-29

tags: sfeed, rss, terminal

Sfeed is a RSS and Atom parser (and some format programs). It converts RSS or Atom feeds from XML to a TAB-separated file. There are formatting programs included to convert this TAB-separated format to various other formats. There are also some programs and scripts included to import and export OPML and to fetch, filter, merge and order feed items.

Sfeed is a program made by Hiltjo Posthuma, the same developer who crafted stagit which I used a lot for personal projects and other cool things like lel. If you wanna know more about his work go into his public website, Codemadness.

Sfeed is a good replacement for Newsboat. Newsboat has too many dependencies and the installed size is huge for what the program pretends to do.

If your distribution already comes with sfeed and sfeed_curses go ahead and install them.

Create a hidden directory called .sfeed.

$ mkdir ~/.sfeed

Copy paste the following text in a file called sfeedrc. Place it inside ~/.sfeed.

fetch() {
    if [ "$(netstat -nl | grep 9050)" ]; then
        curl --socks5 localhost:9050 -L --max-redirs 1 -H "User-Agent:" -fs -m 15 "$2" 2>/dev/null
    else
        curl -L --max-redirs 1 -H "User-Agent:" -fs -m 15 "$2" 2>/dev/null
    fi
}

feeds() {
    feed "unblogmas" "https://unblogmas.ar/rss.xml"
    feed "cat-v" "http://harmful.cat-v.org/Blog/index.rss"
    feed "suckless" "https://suckless.org/atom.xml"
    feed "9front" "https://code.9front.org/hg/plan9front/rss-log"
    feed "xbps changes" "https://github.com/void-linux/xbps/commits/master.atom"
    feed "voidlinux news" "https://voidlinux.org/atom.xml"
    feed "void-packages commits" "https://github.com/void-linux/void-packages/commits/master.atom"
}

Those shell functions from above will be overriding the default functions that come with sfeed. You can later change the RSS urls to ones you like most. The shell function fetch() I wrote also replaces the default way to fetch feeds. What does it do? If there is Tor service running on your computer, it will use socks5 proxy, otherwise it will fetch normally without using any proxy.

Now fetch. Manually. Like a real man.

$ sfeed_update

As you may see, lots of files have been created and placed under a new created directory called ~/.sfeed/feeds.

You can take a look by running this command.

$ ls ~/.sfeed/feeds

Now use sfeed_curses to read the feeds.

$ sfeed_curses ~/.sfeed/feeds/*

You can even use other programs such as fzf by piping the fetched files into that program.

$ sfeed_plain ~/.sfeed/feeds/* | fzf

Yes, it's that simple. There are many customizations to it, but that's the simple usage. I don't know why YouTubers tech personalities pretend like this is some arcane obscure wizardry.

There is more to Sfeed but that's up to the user and its creativity.

Happy fetching!