Hey Matt,

Sorry for not getting back to ya sooner.

Yes, they do have caching and you should be able to use a bust cache
param. I can confirm with one of the AJAX/Feed API developers if you
need any specifics (they are in the IRC channel)

There are quite a few ways this can work in gadgets. :)

I personally prefer using JSONP where I dynamically write a script tag
and provide a &callback parameter then it does the eval on it that way
and calls my callback function (doing that in my google wave gadgets),
or you can use the gadgets API fetch content and parse it as you have
done or use a javascript JSON parser like
http://json-sans-eval.googlecode.com/svn/trunk/src/json_sans_eval.js
or http://json.org/json2.js

Or PHP CURL and use the built in PHP JSON parser (or Services_JSON for
earlier versions of PHP) or a few other options also.

As you notice there are extra feed tags available (like the Author
field ;)) and you can also use &output=json_xml and get an escaped XML
string as well and parse that also if you need all the XML tags (or
for custom XML). I have a parser I made for that so I can get the
enclosure value for my podcast/mp3 player (for podcast feeds)

BTW - feeds don't load correctly? I haven't had any issues and if you
do you should post it in the IRC channel for them to investigate.
(lisbakke is one of the developers there) or of course the groups.

Anyways, glad you got it going though and hope you find it as handy as
I do :D

Cheers!
Vision Jinx

On Jun 9, 1:21 pm, Matt Kruse <[email protected]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to