Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!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>Blogger Data API Sample</title>
- <script src="http://www.google.com/jsapi" type="text/javascript"></script>
- <script type="text/javascript">
- google.load("gdata", "1.x", { packages : ["blogger"] });
- </script>
- <script type="text/javascript">
- function _run() {
- /*
- * Retrieve a list of blog posts
- */
- // Obtain a reference to the 'content' div
- var content = document.getElementById('content');
- // Create the blogger service object
- var bloggerService =
- new google.gdata.blogger.BloggerService('com.appspot.interactivesampler');
- // The feed for a single blog. (In this case, the Official Google Blog.)
- //
- // The ID included in this URI can be retrieved from the
- // <link rel="service.post"> element in the Blog's HTML source
- var feedUri = 'http://www.godsongs.net/feeds/posts/default?published-min=2004-01-30T14:00:00&published-max=2012-01-31T23:59:00&max-results=200';
- // A callback method invoked getBlogPostFeed() returns data
- var handleBlogPostFeed = function(postsFeedRoot) {
- var posts = postsFeedRoot.feed.getEntries();
- // This variable will buffer HTML output until function completes
- var html = '';
- // Display blog's title
- html += '<dl>'
- + '<dt>'
- + '</dt>';
- // Display blog posts
- html += '<dd>';
- for (var i = 0, post; post = posts[i]; i++) {
- var postTitle = post.getTitle().getText();
- var postURL = post.getHtmlLink().getHref();
- html += '' + postTitle + ' * '
- + postURL
- + '<br/>';
- }
- html += '</dd>';
- // Write out buffered HTML, and clear the "Loading..." message
- content.innerHTML = html;
- };
- var handleError = function(error) {
- content.innerHTML = '<pre>' + error + '</pre>';
- };
- bloggerService.getBlogPostFeed(feedUri, handleBlogPostFeed, handleError);
- }
- google.setOnLoadCallback(_run);
- </script>
- </head>
- <body style="font-family: Arial;border: 0 none;">
- <div id="content" style="width:100%;">Loading...</div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement