I'm trying to get the Google AJAX API to read XML from the digg
ListStories API (
http://apidoc.digg.com/ListStories) to get a feed
from a specific digg account. I've done this successfully with other
feeds, but not with the digg API. Here's the URL to the feed using the
digg API:
http://services.digg.com/user/photomask/submissions?count=10&appkey=http%3A%2F%2Fwww.pozzetta.com%2fproducts
When I try to use this feed with the Google API, I always get the
"feed could not be loaded" error. Here's my code; its the Google
sample code wiht few changes (note that the appkey parameter is not
the google appkey, but something required by digg, see
http://apidoc.digg.com/ApplicationKeys)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
<title>Google AJAX Feed API - Simple Example</title>
<script type="text/javascript" src="
http://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load("feeds", "1");
function initialize() {
var feed = new google.feeds.Feed("
http://services.digg.com/user/
photomask/submissions?count=10&appkey=http%3A%2F%
2Fwww.pozzetta.com
%2fproducts");
feed.setResultFormat(google.feeds.Feed.XML_FORMAT);
feed.load(function(result) {
var container = document.getElementById("feed");
if (!result.error) {
var items =
result.xmlDocument.getElementsByTagName("story");
for (var i = 0; i < items.length; i++) {
var titleElement = items[i].getElementsByTagName("title")
[0];
var title = titleElement.firstChild.nodeValue;
var div = document.createElement("div");
div.appendChild(document.createTextNode(title));
container.appendChild(div);
}
}
});
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body>
<div id="feed"></div>
</body>
</html>
Hank