简体   繁体   English

Blogger JSON Feed API超过500个帖子

[英]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? 我使用Blogger JSON Feed API来获取所有帖子[json.feed.entry [i] .published。$ t]的发布时间,但是我的博客有500多个帖子,而API仅获得500个帖子?

I have searched on the internet know that is the limit of Feed API. 我在网上搜索过,知道这是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. 如果使用旧的API,则使用其他的JSON Feed API。

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: 我的解决方案是调用所有feed api,首先我将其称为default:

<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: feed api操作完成后,我添加了feed api的旧帖子,例如:

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. 我的json回调将再次使用feed api旧帖子进行调用。

Use Google JavaScript Client Library - Blogger API to retrieve all posts of a blog. 使用Google JavaScript客户端库-Blogger API检索博客的所有帖子。

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. 我认为博客作者每个请求最多只能提供500个服务,因此服务数量不能超过500个。

CMIIW CMIIW

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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