Class: Feedlib

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/feedlib.rb

Instance Method Summary collapse

Instance Method Details

#fetch(url) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/feedlib.rb', line 11

def fetch(url)
  begin
    f = open(url, 'r')
    xml = f.read()
    encoding = UniversalDetector::encoding(xml)
    xml = Iconv.iconv("UTF-8", encoding, xml).join
    f.close
    parser = get_parser(xml)
    parser.feed
  rescue OpenURI::HTTPError => e
    raise UnavailableFeedSourceError
  end
end