logo

Tested on OpenBSD 6.3 and 6.4

Generate RSS feeds with grep(1), sed(1), and awk(1)

rssg is an RSS feed generator written in shell. It’s a good companion for ssg.

It gets feed’s description, URL, and the list of items from an index file.

Then for every item it extracts its title and treats the rest of the file as its description, replacing all relative URLs with absolute ones.

An index file can be in HTML or in Markdown format.

Finally, rssg outputs the feed in XML format.

rssg 148 LoC. grep and sed everything

Install

Download and chmod it:

$ ftp -Vo bin/rssg https://www.romanzolotarev.com/bin/rssg
rssg       100% |*********************|    4137      00:00
$ chmod +x bin/rssg
$ doas pkg_add lowdown
quirks-2.414 signed on 2018-03-28T14:24:37Z
lowdown-0.3.1: ok
$

Usage

$ rssg index.html 'title' > rss.xml
$

Here is an example of a minimal index.html file:

<h1>People who run BSD</h1>

<p>
Stories written by users of BSD operating systems.
Hosted by Roman Zolotarev.
</p>

<p>
Subscribe via <a href="https://runbsd.info/people/rss.xml">RSS</a>.
</p>

<ul>
<li><a href="mischapeters.html" title="2018-08-07">Mischa Peters</a></li>
<li><a href="h3artbl33d.html" title="2018-08-06">h3artbl33d</a></li>
</ul>

HTML parsing rules:


Thanks to Devin Teske for her awk(1) wizardry.