I've had a look at JFeed's readme and it doesn't mention anyway to get to an RSS item's image:
JFeedItem properties
* item.title
* item.link
* item.description
* item.updated
* item.id
Does anyone know a way to parse these images?
I've had a look at JFeed's readme and it doesn't mention anyway to get to an RSS item's image:
* item.title
* item.link
* item.description
* item.updated
* item.id
Does anyone know a way to parse these images?
Short answer "No".
There is no default jFeed support for "image" access for RSS (or "icon"/"logo" access for ATOM).
That said you could always extend the library to support feed images. For example in jrss.js you could add:
var image = jQuery('image', xml).eq(0);
this.image = new Object();
this.image.url = jQuery(image).find('url:first').text();
this.image.title = jQuery(image).find('title:first').text();
this.image.link = jQuery(image).find('link:first').text();
From an RSS feed you would then be able to access:
feed.image.url
But this only facilitates accessing the graphic for the entire feed and not individual items.
To support individual item images you would need to extend jFeed to allow it to support attributes in some way.
For example to support RSS 2.0 enclosures you could fold the attributes into elements, so you would be able to access something like:
item.enclosure.url
In jrss.js you could add something like:
jQuery('item', xml).each( function() {
var item = new JFeedItem();
item.title = jQuery(this).find('title').eq(0).text();
item.link = jQuery(this).find('link').eq(0).text();
item.description = jQuery(this).find('description').eq(0).text();
item.updated = jQuery(this).find('pubDate').eq(0).text();
item.id = jQuery(this).find('guid').eq(0).text();
item.enclosure = new Object();
var enc = jQuery(this).find('enclosure');
item.enclosure.url = jQuery(enc).attr('url');
item.enclosure.length = jQuery(enc).attr('length');
item.enclosure.type = jQuery(enc).attr('type');
feed.items.push(item);
});
I'm tired and making this up as I go along, can you tell? ;)