[LRUG] Parsing RSS in Ruby

Richard Conroy richard.conroy at gmail.com
Sat May 4 02:17:45 PDT 2013


There are quite a few RSS libraries in Ruby, but none seem popular.

Nokogiri and some kind of high performance HTTP client seems to be the
standard way of processing RSS feeds.


On Sat, May 4, 2013 at 3:44 AM, Michael Mokrysz <sites at 46bit.com> wrote:

> This is a bit of a non-answer, but if the content of those feeds isn't too
>> complex, you could just parse them with a generic XML parser like Nokogiri
>> (or whatever is fashionable now). Getting all recent LRUG meeting titles,
>> links and descriptions, for example, is just a few lines of code:
>>
>
> Aha - that's brilliant, thanks a lot Niko. I'd started to wonder if I was
> missing the obvious, seems I was.
>
> On Fri, May 3, 2013 at 8:52 PM, Niko Felger <niko.felger at gmail.com> wrote:
>
>> Hi Michael,
>>
>> This is a bit of a non-answer, but if the content of those feeds isn't
>> too complex, you could just parse them with a generic XML parser like
>> Nokogiri (or whatever is fashionable now). Getting all recent LRUG meeting
>> titles, links and descriptions, for example, is just a few lines of code:
>>
>> require 'rubygems'
>> require 'nokogiri'
>> require 'open-uri'
>>
>> url = 'http://lrug.org/rss/meetings/'
>> doc = Nokogiri::XML(open(url) {|file| file.read})
>> doc.css('item').each do |item|
>>   puts item.at('title').text
>>   puts item.at('link').text
>>   puts item.at('description').text[0..250]
>> end
>>
>> HTH,
>> Niko
>>
>>
>> On Fri, May 3, 2013 at 11:56 PM, Michael Mokrysz <sites at 46bit.com> wrote:
>>
>>> Howdy,
>>>
>>> I'd like to parse a few dozen RSS feeds with Ruby, but I'm not sure how
>>> best to parse them. Any recommendations between RSS in Stdlib<http://www.ruby-doc.org/stdlib-2.0/libdoc/rss/rdoc/RSS.html>or a gem?
>>>
>>> Thanks,
>>> Michael Mokrysz
>>>
>>> _______________________________________________
>>> Chat mailing list
>>> Chat at lists.lrug.org
>>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>
>>>
>>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>


-- 
http://richardconroy.blogspot.com | http://twitter.com/RichardConroy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130504/ec3229ea/attachment-0003.html>


More information about the Chat mailing list