A question regarding the MyFriends RSS aggregator and RSS feeds in general came through sometime in December, but got lost in my inbox. So, I'm responding, now. Here is the question:
2
3Is there a way to pull the publishing date from the feed itself or a way to insert the date on our own to try and sort by date or to pull out the 10 latest news stories from 20 different feeds?
Is a way to add date information to the database? Yes, in fact I've been working on a modification to MyFriends to grab all the (potentially optional) RSS fields, including the pubdate field.
As far as CF is concerned, the publishing date coming through the XML is a text field. You should be able to get to it like this:
Pubdate is optional according to the RSS spec, so in the code, I'm doing a check similar to this:
2 <cfif IsDefined("TempItem.pubDate") and IsDate(TempItem.pubDate.xmlText)>
3 Store Date
4<cfelse>
5 Else store null
6</cfif>
This should be considered psuedo-code. You won't be able to copy and paste it to get it to work.
I'm storing the date field in the items table of the database. Once it's stored you can easily use SQL to get the top 10 latest stories from feeds, like this:
2 from items
3 order by pubdate desc
Ta Da! So, when will this 'updated' version of the RSS aggregator code be available? Beats me! As with all open source stuff, I'll get to it when I get to it.