English Standard Version Now Has RSS Feed

I first saw it on Glenn Slaven's blogsite, that the publisher of the English Standard Version Bible, Good News Publisher, is now providing RSS feed for ESV. It provides two kinds of feed - verse of the day as well as querying, and RSS 2 result is returned. Congratulation goes to GNP for adding more web services!

While Glenn has provided a Perl script on his blogsite, that retrieves verse of the day in RSS and generates HTML/PHP, which can be included on the index page, Dean Peters of Heal Your Church Website also added more Perl scripts using the more liberal RSSLite module. Not that I still remembered any Perl, but here we go - we have two scripts that generate verse of the day into HTML. Wait. Three if you include Dean's PHP script that does pretty much the same thing...

And it won't be difficult to write a similar script in Python either. With Mark Pilgrim's Ultra-liberal RSS parser, it should take no time to convert Dean's RSSLite based script from Perl to Python.

Here's my attempt:

And the syntax highlighted source:

#!/usr/bin/env python

# module "feedparser" can be downloaded from Mark Pilgrim's website:
# http://diveintomark.org/projects/feed_parser/
import feedparser
import re

rssfeed = "http://www.gnpcb.org/esv/share/rss2.0/daily/"
outfile = "dailyverse.inc.php"

result = feedparser.parse(rssfeed)
output = open(outfile, 'w')

print >>output, '<div class="dailyScripture">'

for item in result.entries:
    print >>output, item.summary+'<br/>'
    print >>output, '<a href="%s" title="%s">%s</a>' % 
    (item.link, result.feed.tagline, item.title)
    if item.get('enclosures'):
        print >>output, ' (<a href="%s">Listen</a>)' % item.enclosures[0].url
    print >>output, '<br/><br/>'

copyright = re.sub(r'[t|n|s]+', ' ', result.feed.copyright).strip()

print >>output, '<span class="credits"><a href="%s" title="%s">%s</a></span>' % 
    (result.feed.link, copyright, result.feed.title)
print >>output, '</div>'


Updated 3 May 2005: This script has been updated to provide a link to ESV's audio edition, so that you not only can display the daily verse on your site, you can also listen to it pronounced.