# RSS and images

**URL:** <https://www.ruby-forum.com/t/rss-and-images/181020>\
**Category:** Ruby\
**Created:** [January 4, 2010, 12:20am UTC](https://www.ruby-forum.com/t/rss-and-images/181020 "2010-01-04T00:20:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@gibbons](https://www.ruby-forum.com/u/gibbons)\
**Post date:** [January 4, 2010, 12:20am UTC](https://www.ruby-forum.com/t/rss-and-images/181020/1 "2010-01-04T00:20:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@gibbons](https://www.ruby-forum.com/u/gibbons)\
**Post date:** [January 4, 2010, 7:18pm UTC](https://www.ruby-forum.com/t/rss-and-images/181020/2 "2010-01-04T19:18:23Z")

</div>

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:

 Watering Holes: Memphis At the Santora http://daily.likeme.net/?p=184 \<![CDATA[The SanTana outpost...

]]\> \<![CDATA[

![](http://i934.photobucket.com/albums/ad189/nunadooch/LikeMe/Picture6-1.png)

The SanTana outpost...]]\>

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

---

<div class="post-metadata">

**Author:** ![gibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@gibbons](https://www.ruby-forum.com/u/gibbons)\
**Post date:** [January 5, 2010, 12:55pm UTC](https://www.ruby-forum.com/t/rss-and-images/181020/3 "2010-01-05T12:55:03Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: RSS and images” on Tue, 5 Jan 2010 03:18:25 +0900,  
Christopher G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ‘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 not .

> 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,

---

<div class="post-metadata">

**Author:** ![gibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@gibbons](https://www.ruby-forum.com/u/gibbons)\
**Post date:** [January 4, 2010, 2:34pm UTC](https://www.ruby-forum.com/t/rss-and-images/181020/4 "2010-01-04T14:34:37Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“RSS and images” on Mon, 4 Jan 2010 08:20:15 +0900,  
Christopher G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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,
