RSS and images

Hi all,

Using the default Ruby RSS parser, which format is best suited to
pulling in images from feed elements, RSS2 or Atom?

And then, how do I use the RSS classes to pull those images, per feed
element? I am not finding examples, and the api is a bit baroque.

If it matters, I'm pulling RSS from Wordpress, of which I also have
admin access (can even change/set plugins).

Thank you!

Chris G.

···

--
Posted via http://www.ruby-forum.com/.

Hi,

In <b002dd1e5a048702c14ecb5650bd0a1a@ruby-forum.com>
  "RSS and images" on Mon, 4 Jan 2010 08:20:15 +0900,

Using the default Ruby RSS parser, which format is best suited to
pulling in images from feed elements, RSS2 or Atom?

And then, how do I use the RSS classes to pull those images, per feed
element? I am not finding examples, and the api is a bit baroque.

  rss20 = RSS::Parser.parse(rss20_xml)
  image = rss20.channel.image
  puts image.url if image and image.url

  atom = RSS::Parser.parse(atom_xml)
  logo = atom.feed.logo
  puts logo.content if logo and logo.content

Thanks,

···

Christopher Galtenberg <galtenbergs@gmail.com> wrote:
--
kou

Thanks for the reply back.

'channel', I believe, is a wrapper for items. So the code just seems to
pull back the logo for the feed, not individual item images.

Let me paste in a snippet of RSS:

<item>
  <title>Watering Holes: Memphis At the Santora</title>
  <link>http://daily.likeme.net/?p=184</link>
  <description><![CDATA[The SanTana outpost...<p>]]></description>
    <content:encoded><![CDATA[<p><img
src="http://i934.photobucket.com/albums/ad189/nunadooch/LikeMe/Picture6-1.png"
alt="" width="600" /></p>The SanTana outpost...]]></content:encoded>
</item>

Wordpress uses <content:encoded> to store the media referenced in the
item.

Is there a ruby way of getting to <content:encoded>?

Or does anyone know a way to force Wordpress to output better RSS?

Thanks again,

Chris

···

--
Posted via http://www.ruby-forum.com/.

Hi,

In <8aa4c207fd0960ecab2085d82aa90ba9@ruby-forum.com>
  "Re: RSS and images" on Tue, 5 Jan 2010 03:18:25 +0900,

'channel', I believe, is a wrapper for items. So the code just seems to
pull back the logo for the feed, not individual item images.

'channel' is for <channel> not <item>.

<item>
  <title>Watering Holes: Memphis At the Santora</title>
  <link>http://daily.likeme.net/?p=184&lt;/link&gt;
  <description><![CDATA[The SanTana outpost...<p>]]></description>
    <content:encoded><![CDATA[<p><img
src="http://i934.photobucket.com/albums/ad189/nunadooch/LikeMe/Picture6-1.png&quot;
alt="" width="600" /></p>The SanTana outpost...]]></content:encoded>
</item>

Wordpress uses <content:encoded> to store the media referenced in the
item.

Is there a ruby way of getting to <content:encoded>?

  rss20 = RSS::Parser.parse(rss20_xml)
  rss20.items.each do |item|
    puts item.content_encoded
  end

Thanks,

···

Christopher Galtenberg <galtenbergs@gmail.com> wrote:
--
kou