The API does not display new entries or feed updates immediately because it caches the feed and re-crawls it periodically. This is done for two primary reasons: (1) to improve performance be eliminating the need for a round trip to your server, which may take time to respond; and (2) to limit network traffic, save bandwidth, and reduce the load on your servers. The documentation used to say (and may still) that you can expect feeds to be refreshed generally no more than once per hour, with those feeds receiving more traffic being refreshed at shorter intervals than others.
If it is essential to have the updates immediately, you might try adding a dummy cache-busting parameter to your feed URL. This will force the API to crawl the feed new every time it is requested. But it will also nullify the two advantages mentioned above. So if your server is slow to respond with your feed, your application could run slowly or, worse, you could get error messages saying that your feed is 404. Jeremy R. Geerdes Generally Cool Guy Des Moines, IA For more information or a project quote: jrgeer...@gmail.com If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church! On Mar 24, 2012, at 3:58 PM, Tod wrote: > I have a Google Feed script working quite well, except that when new > blog items are created or updated, my feed using the script does not > update. Randomly I can get the feeds to update (not sure how) but not > consistently. > > The feed is pulling from a Wordpress Blog. > > I am guessing that the feed variable needs to be reset because it is > storing the XML in the browser from my Wordpress blog? > > Any suggestions? Do I need a function that resets var feed? If so, > how do I do that? > > My script has two feeds, for two different parts of the page (querying > by category). Here is my script: > > <script type="text/javascript"> > var feed = 0; > google.load("feeds", "1"); > google.setOnLoadCallback(BlogFeed); > google.setOnLoadCallback(EventFeed); > String.prototype.truncate = function(to_length){ > if(to_length >= this.length)return > this; > return this.substring(0, > to_length-3)+'...'; > } > function BlogFeed() { > var feed = new google.feeds.Feed("http://edgeworksclimbing.com/ > blog/feed/"); > feed.setNumEntries(10); > feed.load(function(result) { > if (!result.error) { > var container = > document.getElementById("blog-headline"); > for (var i = 0; i < result.feed.entries.length; i++) { > var entry = result.feed.entries[i]; > var date = new Date(entry.publishedDate); > date = > date.toDateString().substr(4); > var blogcategory = > entry.categories; > if(blogcategory != > "Events") { > var li > = document.createElement("li"); > > li.className = "rss-item"; > > li.innerHTML = '<a class="rss-item" href="' + entry.link + '" > target="_self">' + entry.title + '</a><br>'; > > li.innerHTML += '<a class="rss-date" href="' + entry.link + '" > target="_self">' + date + '<cite class="rss-author"> by ' + > entry.author + '</cite></a> ' + entry.categories + '<br>'; > > li.innerHTML += '<a class="rss-snippet" href="' + entry.link + '" > target="_self">' + entry.contentSnippet.truncate(50) + '</a>'; > > container.appendChild(li); > } > } > } else { > var container = > document.getElementById("blog-headline"); > container.innerHTML = '<li><a > href="http://www.edgeworksclimbing.com/blog">Edgeworks Blog</a></li>'; > } > }); > } > function EventFeed() { > var feed = new google.feeds.Feed("http://edgeworksclimbing.com/ > blog/feed/"); > feed.setNumEntries(10); > feed.load(function(result) { > if (!result.error) { > var container = > document.getElementById("event-headline"); > for (var i = 0; i < result.feed.entries.length; i++) { > var entry = result.feed.entries[i]; > var date = new Date(entry.publishedDate); > date = > date.toDateString().substr(4); > var eventcategory = > entry.categories; > > if(eventcategory.indexOf("Events") != -1) { > var li > = document.createElement("li"); > > li.className = "rss-item"; > > li.innerHTML = '<a class="rss-item" href="' + entry.link + '" > target="_self">' + entry.title + '</a><br>'; > > li.innerHTML += '<a class="rss-date" href="' + entry.link + '" > target="_self">' + date + '<cite class="rss-author"> by ' + > entry.author + '</cite></a> ' + entry.categories + '<br>'; > > li.innerHTML += '<a class="rss-snippet" href="' + entry.link + '" > target="_self">' + entry.contentSnippet.truncate(50) + '</a>'; > > container.appendChild(li); > } > } > } else { > var container = > document.getElementById("event-headline"); > container.innerHTML = '<li><a > href="http://www.edgeworksclimbing.com/blog">Edgeworks Blog</a></li>'; > } > }); > } > </script> > > -- > You received this message because you are subscribed to the Google > Groups "Google AJAX APIs" group. > To post to this group, send email to > google-ajax-search-api@googlegroups.com > To unsubscribe from this group, send email to > google-ajax-search-api+unsubscr...@googlegroups.com > To view this message on the web, visit > http://groups.google.com/group/google-ajax-search-api?hl=en_US > For more options, visit this group at > http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en -- You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to google-ajax-search-api@googlegroups.com To unsubscribe from this group, send email to google-ajax-search-api+unsubscr...@googlegroups.com To view this message on the web, visit http://groups.google.com/group/google-ajax-search-api?hl=en_US For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en