Skip to content

Instantly share code, notes, and snippets.

@rmasters
Created March 19, 2009 20:33
Show Gist options
  • Save rmasters/82035 to your computer and use it in GitHub Desktop.
Save rmasters/82035 to your computer and use it in GitHub Desktop.
Using the Google Feeds API
// Load the feeds library, version 1
google.load("feeds", "1");
// Callback function
function initialize() {
// The feed we want to load
var feed = new google.feeds.Feed("http://www.digg.com/rss/index.xml");
// Load the feed
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
div.appendChild(document.createTextNode(entry.title));
container.appendChild(div);
}
}
});
}
// Set the callback function
google.setOnLoadCallback(initialize);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment