RSS: Advantages and usage

tags: engineering · tutorials

RSS (Really Simple Syndication) is a standardized protocol for creating and sharing web feeds. An RSS feed is an XML file consisting of entries, each of them usually corresponding to an article. Programs called “RSS aggregators”, parse these files and provide a nice display where you can nagivate through each entry as if it were a news feed. This is a very convenient way to “follow” websites because all you have to do is grab their RSS URL, add it to your aggregator, and read the articles once it parses the feed.

On the website owner’s end, a new entry needs to be added whenever a new article is published. The entry usually includes a short summary of the article, or as is the case for my website, the whole article, so that you can read it all through your RSS reader.

Why bother

RSS is an open protocol, it’s decentralized, and very simple both in terms of parsing and maintaining. Because RSS is such a simple protocol, it can adapt to everyone’s workflow. There are RSS readers for Android, Windows, UNIX, web browsers, email clients, etc.

Apart from the technical advantages RSS provides, it’s also a great way to have a personal, uncensored feed, following only the websites you want — even YouTube channels and Twitter accounts — without ads and additional noise and distractions.

I personally use sfeed as an RSS reader, because I like the extensibility it offers. I’ve written a small patch for sfeed_curses(1), so that you can bookmark feed entry URLs to a predefined file. I use this mostly to queue videos and podcasts and then stream them through mpv using a very simple script I created, which, all it does is read the “queue” file and pipe the URLs to mpv.

How to create and maintain an RSS feed

Below is a very basic RSS feed. Inside the <channel> tags is the whole feed, and inside <item> is each individual entry. The rest of the tags are pretty self-explanatory, if not, feel free to read the specification. The article/summary is placed inside <description> — that can be in plain text or encoded HTML:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>

<title>Example Org</title>
<description>Example Org's RSS feed</description>
<link>http://www.example.org/rss.xml</link>

<item>
<title>Example entry</title>
<link>http://www.example.org/blog/post.html</link>
<pubDate>Sun, 06 Sep 2009 16:20:00 +0000</pubDate>
<description>
Here is some text containing an interesting description.
</description>
</item>

</channel>
</rss>

To create a new entry, you can either handwrite it in the XML file yourself, make a script or small program to do it automatically, or use some existing tool. I prefer to use my own script, since it’s a dead simple thing to do.

To share the feed, simply add the URL to your website and tell people to subscribe to it. For example, my website’s RSS feed can be obtained from https://margiolis.net/w/rss.xml.

RSS for YouTube and social media

Even though they purposefully make it hard to find, so that you can stay on their platform, YouTube, Twitter, Reddit, and other services, offer RSS feeds, and even if they don’t, there are ways you can generate one.

YouTube

Go to the channel’s home page, right-click and click on “Page source” and search for channelId" content. Copy the hash inside content="" and append it to the following URL (replace hash):

https://www.youtube.com/feeds/videos.xml?channel_id=hash

GitHub

You can get an RSS feed for each new commit that happens in a given branch. Replace username, repo and branch with the correct values:

https://github.com/username/repo/commits/branch.atom

Twitter

Twitter does not actually offer RSS feeds anymore, but there is a proxy site for Twitter called nitter that does. Replace username with the account’s username you want to follow:

https://nitter.net/username/rss

Reddit

Each subreddit has an RSS feed under this URL (replace subreddit):

https://www.reddit.com/r/subreddit.rss

Facebook and others

There’s a nice program called RSS-Bridge that can generate RSS feeds for websites which don’t have one. RSS-Bridge is installed and run on your server, but there are public instances you can use.