rss feed

Scala: How to download and process XML data (such as an RSS feed)

I was looking for a good way to access XML resources (like RSS feeds) in Scala, and I currently like the idea of using ScalaJ-HTTP to access the URL and download the XML content, and then using the Scala XML library to process the XML string I download from the URL.

This example Scala program shows my current approach:

Trying RSS readers again

As a bit of an experiment, I’m trying a couple of RSS readers again. I got away from them for a while, but once you realize you have a series of interests that you want to keep up with, I think they make sense. They don’t give you the “discovery” aspect you find with other sources, but they’re good for consistency.

Important parts of a good RSS reader are being able to organize sources into folders, showing the RSS list and previews of each article, and being able to keep my lists in sync across multiple devices.

A simple Python feedparser script

As a quick example today, the following source code is for a Python feedparser script I wrote, based on the URL shown:

How to load an XML URL in Scala (contents of an XML web page)

Scala XML FAQ: How do I load an XML URL in Scala? (How do I read/download the contents of an XML URL in Scala?)

To load the contents of an XML URL (web page) in Scala, such as an RSS news feed or RESTful web service, just use the load method of the Scala XML class:

val xml = XML.load("http://www.devdaily.com/rss.xml")

Here's an example of what this looks like in the Scala REPL:

A Perl program to determine RSS readers from an Apache access log file

Perl/RSS FAQ: How many RSS subscribers do I have on my website?

Like many other people with a blog or website, I was curious yesterday about how many RSS readers/subscribers the devdaily website has. You can try to get this information in a variety of ways, but the real information is on your server, in your Apache log files.

To figure out how many RSS subscribers your website has, just go through your Apache log file, find all the records that look like this: