On Jun 9, 2:12 pm, Matt Kruse <[email protected]> wrote:
> Oops, that line was for my debugging, it shouldn't be in there :)
> Corrected:
Argh! I had a typo in there. I finally got it into a gadget and made
it work, so this version should be correct. Sorry for the confusion.
I've noticed that feeds don't always load correctly through this API,
either. Not sure why. But it does seem faster and more reliable than
the other one, with the huge bonus (for me) of having the Author
field.
function _IG_FetchFeedAsJSON(url,callback,num,summaries) {
var gurl = 'http://ajax.googleapis.com/ajax/services/feed/load?
v=1.0&num='+num+'&q=' + encodeURIComponent(url)+'&random='+ (+new
Date);
_IG_FetchContent(gurl,function(responseText) {
var json = eval('('+responseText+')');
if (!json || !json.responseData || !json.responseData.feed || !
json.responseData.feed.entries || json.responseStatus!=200) {
json.ErrorMsg = json.responseDetails;
}
else {
var feed = json.responseData.feed;
json.URL=url;
json.Title=feed.title;
json.Description=feed.description;
json.Link=feed.link;
json.Author=feed.author;
json.Entry=[];
for (var i=0; i<feed.entries.length; i++) {
var entry = feed.entries[i];
var date = new Date(entry.publishedDate);
date = date?date.getTime():new Date();
json.Entry.push( {
Title:entry.title,
Link:entry.link,
Summary:entry.content,
Date:date,
Author:entry.author,
Categories:entry.categories
} );
}
}
callback(json);
});
}
Matt Kruse
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---