This post originated from an RSS feed registered with Ruby Buzz
by Premshree Pillai.
Original Post: I’m tuned to Virgin Radio Classic Rock
Feed Title: Premshree's Personal Weblog
Feed URL: http://premshree.livejournal.com/data/rss
Feed Description: Premshree's Weblog
My music now comes from Virgin Radio Classic Rock. So, in case you want to use this script with that station, you’ll have to make changes to song_title:
$url = 'http://www.virginradio.co.uk/classicrock/last.html'
resp = Net::HTTP.get_response(URI.parse($url))
body = resp.body
if body =~ /<td valign=top><a href=\'[\w\W]+\' class=\'pagecolour\'>([\w\W]*)<\/a><BR><span style=\'font-size:80%;\'>([\w\W]*)<
\/span><\/small><\/td>[\r\n]+/
song_title = [$1, $2].map { |arr_ele|
arr_ele = arr_ele.split(" ").map { |ele|
ele = ele.capitalize
}.join(" ")
}.join(" - ")
else
song_title = '(None)'
end