[LRUG] Parsing RSS in Ruby

Michael Mokrysz sites at 46bit.com
Fri May 3 19:44:12 PDT 2013


>
> 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130503/48ad0314/attachment-0003.html>


More information about the Chat mailing list