March 09, 2004

Free UK TV Listings in XMLTV format

www.bleb.org have started offering free TV listings for the UK in XMLTV xml format, which is good news for users of various PVR and EPG programs such as TV Guide and Freeguide-TV etc, who up until recently got them from Ananova.com, luckily bleb.org are now offering UK TV listings in XMLTV format, so my previous posting about using Coldfusion to download and reformat their html listings is no longer necessary, the only thing needed now is to download each channels listings then unzip them. I've written a Bourne shell script that does just this specifically for TV Guide. Heres the script

-----------------------------
# filename: UKTVgrab.sh
# Get today's UK TV listings in XMLTV format
#
BASE_URL='http://bleb.org/tv/data/listings'
DAYS=1
FORMAT=XMLTV
FILE=ZIP
CHANNELS="bbc1 bbc2 itv1 ch4 five"

for ch in $CHANNELS
do
sleep 2
wget -U 'My TV Fetching application (you@yourdomain.com)' \
-O 'bleb-xmltv.zip' \
"$BASE_URL?days=$DAYS&format=$FORMAT&file=$FILE&channels=$ch"
wzunzip -o bleb-xmltv.zip
mv -f data.xml $ch.xml
done
-----------------------------

The reason I wrote the script for the bourne shell, was there was a working example on the bleb mailing list using the bourne shell, and i was having problems getting a DOS batch file version to work, as whenever wget encountered an ampersand in one of WGet's URL parameters, it choked.

Theres more info on their TV listings at their website www.bleb.org/tv and also on their developers mailing list.


Posted by steeev to Cool Websites

at March 9, 2004 08:29 PM
Comments