Heal Your Church WebSite


Teaching, rebuking, correcting & training in righteous web design.

English Standard Version Bible RSS Feed

Have you ever bumped into someone who looks like you? Pretty freaky. Well last night I had a similar experience with a post on another techBlog. Last night I received a nice note from Glenn Slaven that Good News Publishers (GNP) has extended their web services to provide RSS feeds for the English Standard Version Bible. And not only for select verses, but for a verse of the day.

Why the GNP didn’t email me still mystifies me a bit, but that said Glenn gets credit and kudos for offering the first cut at a Verse of the Day RSS Feed. As I told Glenn when I first visited his post on the topic, I thought I was visiting my own site!

That said, I also want to offer a couple of versions of it. Not because of anything lacking with Glenn’s cool code, but because I wanted to integrate the ESV RSS feed into a couple of past articles I posted on the topic, and see if I couldn’t easily mangle them to obviate my beloved but kludgy VerseScrape verse-of-the-day screen scraper.

Okay, first things first. For those of you who do not speak pure geek, an RSS feed is a text file structured in a format called XML. It is a machine-to-machine format, intended to facilitate diaglogs between computer programs on systems regardless of their computer language, operating system and hardware platform. This XML file is sent via the same mechanism web pages are delivered to your browser, the HTTP protocol. In fact, you can read RSS files with your browser, but as you’ll see, they’re not really organized for human consumption. One popular version of such a program is called an aggregator, which many people use to keep track of changes their favorite weblogs or web sites, without having to visit the site in their browser (until the site changes).

This is idea I had in mind when I wrote my article “Using Cron with LWP::Simple and XML::RSS to retrieve news feeds” back in March of this past year. With only a slight modification of the code offered on that page, I’m able to create a verse-of-the-day. Moreover, I can do it in a format that is similar to VerseScrape.

Some of the features in this code not found in Glenn’s SOLID EXAMPLE, is that the code below attempts to read the feed 10 times before giving up. This is good in those cases where burps occur online. Also, this version can accommodate situations in the future where more than one verse is added to the feed. I doubt that will happen, but its there just in case. Finally, I put in some code to strip out some extraneous TAB, LINEFEED and SPACE characters (known in computer parlance as whitespace) in the copyright statement/element delivered in the XML feed.



Now if this is TOO much code for you, here is a “LITE” version that also gets the job done. Based upon an article I wrote this past May entitled “Using XML::RSSLite to read feeds“, I offer this “esvfeedlite.pl.” It is similar to Glenn’s excellent approach, only this example uses the more liberal RSSLite module. Again, it takes care of some of the extraneous ‘whitespace’ issues in the copyright element, and accomodates multiple elements.



Remember to check those file permissions on the program files, AND on the output files. I use “chmod 755 esvfeed.pl” on the former and “chmod 644 dailyverse.inc.php” on the later, but your mileage may vary depending on how your server is set up and how your system is configured to access local files.

Tomorrow, I’ll show you how to do this in PHP … from CRON and/or the command line even!

Oh and Glenn, thanks so much for the email! It and your code are VERY appreciated!

8 Comments

  1. This rocks. I started playing with a php implementation this afternoon at work. I was using this http://www.readinged.com/onyx/rss/ to do the parsing of the rss feed. I look forward to your php version to see how you approach it.

  2. Very nice. I like the idea of checking multiple times for the feed. Thanks for the nice comments & the linkage!

    Will using XML::RSSLite make much of a difference to the speed of the script?

  3. Pingback: Scott Yang's Playground

  4. Thanks for the info. I messed with your script for just a few seconds, but I don’t have the RSS functions in perl or I should say my web host doesn’t.

    I setup the regular rss feeds that I am using with PHPNuke, and it just gives me the verse number, without all the text. I like the way its done on glenn.bluemountains.net.au, so I guess I will play around until I can get it looking like that. I don’t know if my host will add the RSS functions to perl, or I guess I could just put copy and paste the functions and use them in the script.

    Anyways, cool site, and thanks for the info.

    -Matt

    Visit my site http://www.churchrecordings.com

  5. Thanks for the info. I messed with your script for just a few seconds, but I don’t have the RSS functions in perl or I should say my web host doesn’t.

    I setup the regular rss feeds that I am using with PHPNuke, and it just gives me the verse number, without all the text. I like the way its done on glenn.bluemountains.net.au, so I guess I will play around until I can get it looking like that. I don’t know if my host will add the RSS functions to perl, or I guess I could just put copy and paste the functions and use them in the script.

    Anyways, cool site, and thanks for the info.

    -Matt

    Visit my site http://www.churchrecordings.com

  6. Pingback: Development on a shoestring

  7. Pingback: Development on a shoestring

  8. Pingback: Development on a shoestring