google.load("feeds", "1"); function initialize() { var feed = new google.feeds.Feed("http://twitter.com/statuses/user_timeline/85809236.rss"); feed.setResultFormat(google.feeds.Feed.XML_FORMAT); feed.setNumEntries(5); feed.load(function(result) { var container = document.getElementById("tweets"); if (!result.error) { var items = result.xmlDocument.getElementsByTagName("item"); if (items.length > 0) { for (var i = 0; i < items.length; i++) { var titleElement = items[i].getElementsByTagName("title")[0]; var title = titleElement.firstChild.nodeValue; var thetitle = title.substring(12); thetitle = thetitle.replace(/(\bhttp:\/\/\S+(\/|\b))/gi,"$1"); thetitle = thetitle.replace(/[@]+[A-Za-z0-9-_]+/gi, function(u) { var username = u.replace("@",""); return u.link("http://twitter.com/"+username); }) var linkElement = items[i].getElementsByTagName("link")[0]; var thelink = linkElement.firstChild.nodeValue; var pubdateElement = items[i].getElementsByTagName("pubDate")[0]; var pubdate = pubdateElement.firstChild.nodeValue; var thedate = pubdate.substring(5,11); var thetime = pubdate.substring(17,22); var theitem = document.createElement("li"); if ((i%2)==0) { theitem.setAttribute("class","alt"); } theitem.innerHTML = thetitle + ' '; var permalink = document.createElement('a'); permalink.setAttribute('href', thelink); permalink.setAttribute('class', 'nowrap date permatweet'); permalink.setAttribute('title','Tweet\'s permalink'); permalink.innerHTML = ' (' + thetime + ', ' + thedate + ')'; theitem.appendChild(permalink); container.appendChild(theitem); } } else { } } }); } google.setOnLoadCallback(initialize);