[LRUG] Parsing RSS in Ruby (Artem Avetisyan)

artem artemave at gmail.com
Sat May 4 06:21:34 PDT 2013


I used stdlib RSS and it served me well:

https://github.com/artemave/lj-friends-feed/blob/master/lib/rss_items_extractor.rb

Artem

On 4 May 2013, at 10:30, chat-request at lists.lrug.org wrote:

> Send Chat mailing list submissions to
> 	chat at lists.lrug.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.lrug.org/listinfo.cgi/chat-lrug.org
> or, via email, send a message with subject or body 'help' to
> 	chat-request at lists.lrug.org
> 
> You can reach the person managing the list at
> 	chat-owner at lists.lrug.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Chat digest..."
> 
> 
> Today's Topics:
> 
>   1. Parsing RSS in Ruby (Michael Mokrysz)
>   2. Re: Parsing RSS in Ruby (Niko Felger)
>   3. Re: Parsing RSS in Ruby (Michael Mokrysz)
>   4. Re: Parsing RSS in Ruby (Richard Conroy)
>   5. Re: Parsing RSS in Ruby (Jordan Elver)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 3 May 2013 17:56:55 -0400
> From: Michael Mokrysz <sites at 46bit.com>
> To: "chat at lists.lrug.org" <chat at lists.lrug.org>
> Subject: [LRUG] Parsing RSS in Ruby
> Message-ID:
> 	<CAF4GLVjXf3b7iu9a2kit_g5PmPyOaUy6BqsVAkYpX_=u_sTJbA at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> 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
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130503/96684e27/attachment-0001.htm>
> 
> ------------------------------
> 
> Message: 2
> Date: Sat, 4 May 2013 02:52:24 +0200
> From: Niko Felger <niko.felger at gmail.com>
> To: Michael Mokrysz <sites at 46bit.com>
> Cc: "chat at lists.lrug.org" <chat at lists.lrug.org>
> Subject: Re: [LRUG] Parsing RSS in Ruby
> Message-ID:
> 	<CANcVQUcJKCAiHoJx1H9iLg7BS13Gr3nh5bVe_pcTsC5xYRv88w at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> 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/20130504/70f2031f/attachment-0001.htm>
> 
> ------------------------------
> 
> Message: 3
> Date: Fri, 3 May 2013 22:44:12 -0400
> From: Michael Mokrysz <sites at 46bit.com>
> To: Niko Felger <niko.felger at gmail.com>
> Cc: "chat at lists.lrug.org" <chat at lists.lrug.org>
> Subject: Re: [LRUG] Parsing RSS in Ruby
> Message-ID:
> 	<CAF4GLVgCncQA=+yQ8hwf2eCQswFNWLSNrWKGq+tWhyyY1txa8w at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
>> 
>> 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-0001.htm>
> 
> ------------------------------
> 
> Message: 4
> Date: Sat, 4 May 2013 10:17:45 +0100
> From: Richard Conroy <richard.conroy at gmail.com>
> To: Michael Mokrysz <sites at 46bit.com>
> Cc: "chat at lists.lrug.org" <chat at lists.lrug.org>
> Subject: Re: [LRUG] Parsing RSS in Ruby
> Message-ID:
> 	<CAGkXyWPfTFOS18MFyk0EKXLqdpqoBUFCKnjc5XfUQHVtNGy5ww at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> 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-0001.htm>
> 
> ------------------------------
> 
> Message: 5
> Date: Sat, 4 May 2013 10:29:40 +0100
> From: Jordan Elver <jordan.elver at gmail.com>
> To: "chat at lists.lrug.org" <chat at lists.lrug.org>
> Subject: Re: [LRUG] Parsing RSS in Ruby
> Message-ID:
> 	<CAPrgixZt=90jBYJt4zb8pepbpV9AGSudwzfrt_pA=s6a64F_Ww at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
> 
>> Nokogiri and some kind of high performance HTTP client seems to be the
>> standard way of processing RSS feeds.
> 
> Feedzirra seems popular for that.
> 
> https://github.com/pauldix/feedzirra
> 
> 
> ------------------------------
> 
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
> 
> 
> End of Chat Digest, Vol 88, Issue 5
> ***********************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130504/5eb516b5/attachment-0003.html>


More information about the Chat mailing list