views:

60

answers:

0

I have a google ajax api key and I've been trying to access the various google bookmark feeds but am receiving either a 400 bad request or feed did not load error when attempting to access the feed from my script or code.

These are the feeds I've tried accessing:

XML:https://www.google.com/bookmarks/?output=xml&num=1000 Fails using google feeds API.

RSS:https://www.google.com/bookmarks/?output=rss&num=100 Fails using a jquery RSS plugin.

HTML:http://www.google.com/bookmarks/bookmarks.html Fails using jquery ajax.

These feeds will work if I open them in a browser but not in my scripts.

Here's an example of trying to access the xml feed:

<script type="text/javascript" src="http://www.google.com/jsapi?key=...

    google.load("feeds", "1");

    function initialize() {
        var feed = new google.feeds.Feed("https://www.google.com/bookmarks/find?q=&amp;output=xml&amp;num=10000");
        feed.setResultFormat(google.feeds.Feed.XML_FORMAT);
        feed.load(function(result) {
            var container = document.getElementById("feed2");
            if (!result.error) {
                var items = result.xmlDocument.getElementsByTagName("bookmark");
                for (var i = 0; i < items.length; i++) {
                    var titleElement = items[i].getElementsByTagName("title")[0];
                    var title = titleElement.firstChild.nodeValue;

                    var urlElement = items[i].getElementsByTagName("url")[0];
                    var url = urlElement.firstChild.nodeValue;

                    var div = document.createElement("div");
                    div.appendChild(document.createTextNode(title + " (" + url + ")"));
                    container.appendChild(div);
                }
            }
            else {
            alert("failure");
            }
        });
    }
    google.setOnLoadCallback(initialize);

This is the content of the request: google.feeds.Feed.RawCompletion('8', null, 400, 'Feed could not be loaded", 200)

Viewing the contents result variable shows that the request failed because of a 401. Is this just not available or am I missing something here?