require 'hpricot' require 'open-uri' module Flannel class FeedParser def initialize params={} @cache = params[:cache] if params.has_key?(:cache) end def sub_feeds(url) url = format_url(url) get_news(url) end def format_url url url.strip! url = "http://#{url}" if url[0..6] != "http://" url end def get_document url doc = @cache.retrieve(url) if @cache doc = open(url) unless doc @cache.save url, doc if @cache doc end def format_item(link, title) "