简体   繁体   中英

Blogger JSON Feed API more than 500 posts

I use Blogger JSON Feed API get to get time published of the all post [json.feed.entry[i].published.$t], but my blog has than 500 post and API get only 500 post?

I have searched on the internet know that is the limit of Feed API.

http://blog.vnlives.net/feeds/posts/summary?alt=json-in-script&callback=pageNavi&max-results=99999

And if use API old post then use other JSON Feed API other.

http://blog.vnlives.net/feeds/posts/summary?alt=json-in-script&callback=pageNavi&max-results=99999&start-index=501

How to get time published all post in my blog? Please help to me. (sorry my english is not good.)

My solution is call all feed api, the first I'm call default like:

<script src="http://blog.vnlives.net/feeds/posts/summary?alt=json-in-script&callback=recentposts&max-results=99999" type="text/javascript"></script>

And save all the information need into a variable. After the feed api action finish, I'm add feed api old post like:

document.write('<script src="http://blog.vnlives.net/feeds/posts/summary?alt=json-in-script&callback=recentposts&max-results=99999&start-index=501" type="text/javascript"><\/script>');

And my json callback will call again with feed api old post.

Use Google JavaScript Client Library - Blogger API to retrieve all posts of a blog.

See the following example:

  <script>
  function renderResults(response) {
    if (response.items) {
      for (var i = 0; i < response.items.length; i++) {
        //do whatever you want with the posts of your blog
      }      
    }
    if(response.nextPageToken) {
      var blogId = 'XXX Your blogId XXX';
      var request = gapi.client.blogger.posts.list({
        'blogId': blogId,
        'pageToken': response.nextPageToken,
        'maxResults': 100,
      });
      request.execute(renderResults);
    }
  }
  function init() {
    gapi.client.setApiKey('XXX Get your API Key from https://code.google.com/apis/console XXX');
    gapi.client.load('blogger', 'v3', function() {
        var blogId = 'XXX Your blogId XXX';
        var request = gapi.client.blogger.posts.list({
          'blogId': blogId,
          'maxResults': 100,
        });
        request.execute(renderResults);        
    });
  }
  </script>
  <script src="https://apis.google.com/js/client.js?onload=init"></script>

I think blogger only allow to serve max 500 per request, so it's not possible to serve more than 500.

CMIIW

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM