writing an RSS reader in 80 lines of bash
14 points by y0b1byte
14 points by y0b1byte
Uh, this could actually just be done a lot simpler if you use xslt for the XML parsing with xsltproc. Then you can just pre-format the entire feed properly and use bash for what it's good at.
I had a script for this (from an IRC user), but it seems like I've lost the feed.xslt for the actual parsing, but I'll see if I can find it.
https://github.com/Foxboron/home/blob/master/.local/bin/rss
EDIT: A similar source for parsing RSS XML structures into plain text you can parse with bash. https://paste.xinu.at/c38U5a95qgWw/xslt
All derivative work from Earnestly that is doing some rss reader stuff here: https://github.com/Earnestly/webfeeds
That's definitely cleaner and more robust! However, I will still stick to bash as it's less dependencies, and it requires me to learn the new thing, which is xslt.
You need to fix the embedded code, escaping < as <. Without it, the code presented doesn’t work in a few ways, leading me to think the code was more horrifying than it actually is. It’s still somewhat horrifying, but at least now it should mostly work (though it’s still pretty fragile), rather than seldom work.
I had a similar setup where the links I wanted to read in newsboat were stored in a text file. My "do_the_internet.sh" would then send those links to forlater.email so I would receive the content.
Then forlater.email went down for a week. Not having anything to read during that week, I managed to add http/html/rss support to Offpunk.
Never used newsboat again…
Anecdote: forlate.email founder is also the one who invited me on this site. So double thanks to him!