RSS and images

  • Thread starter Christopher Galtenberg
  • Start date
C

Christopher Galtenberg

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.
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"RSS and images" on Mon, 4 Jan 2010 08:20:15 +0900,
Christopher Galtenberg said:
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,
 
C

Christopher Galtenberg

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
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"Re: RSS and images" on Tue, 5 Jan 2010 03:18:25 +0900,
Christopher Galtenberg said:
'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 said:
<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>?

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


Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top