Wrap text
Report abuse
|
|
require 'open-uri'
require 'hpricot'
class Plugins::Sidebars::XmlController < Sidebars::ComponentPlugin
display_name "XML Syndication"
description "RSS and Atom feeds"
def content
response.lifetime = 6.hours
begin
url = "http://api.feedburner.com/awareness/1.0/GetFeedData?uri=snax"
doc = Hpricot.parse open(url)
entry = (doc/:entry).first
@circulation = entry.attributes['circulation']
raise if @circulation.to_i < 100
rescue
@circulation = "657" # hax
end
end
end
|