【问题标题】:Google Feed API JSON output not showing latest recordsGoogle Feed API JSON 输出未显示最新记录
【发布时间】:2015-04-01 10:53:51
【问题描述】:

我正在尝试使用 Google Feed API 加载 Feed,但我无法获取最新记录。我在下面尝试过:

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
  <script type="text/javascript">
      $(function () {
          url = 'http://www.propertyguru.com.sg/news-rss/SG-PM';
          var randomNum = Math.floor((Math.random() * 10000) + 1);
          $.ajax({
              type: "GET",
              url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=20&callback=?&q=' + encodeURIComponent(url) + '&nocache=' + (new Date).getTime() + randomNum,
              dataType: 'json',
              historical: false,
              error: function () {
                  alert("Unable to load feed, Incorrect path or invalid feed");
              },
              success: function (data) {
                  alert(JSON.stringify(data, null, "\t"));
              }
          });
      });
  </script>

【问题讨论】:

  • 您是否尝试将您的 AJAX URL 粘贴到网络浏览器中?
  • 为 firefox 使用一些 REST 客户端插件并测试 REST url....
  • 您的 AJAX 调用成功但返回 null。
  • 这个 RSS 实际上有问题
  • 来自this 提要也没有获得最新记录。

标签: json rss feed google-feed-api


【解决方案1】:

您对q url 查询参数进行了错误编码,callback 参数存在问题。试试这个网址:

https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&q=http://www.propertyguru.com.sg/news-rss/SG-PM

【讨论】:

  • 我仍然没有收到最新记录
  • 将上面的网址粘贴到浏览器中,告诉我你看到了什么。
  • 我可以看到“2015 年 2 月 5 日”的记录,并且 url 有“2015 年 4 月 1 日”的最新记录
  • @TimBiegeleisen 这并不能解决问题。我也有。它大约在一周前出现。在那之前它工作得很好。
猜你喜欢
  • 2013-04-12
  • 1970-01-01
  • 2016-09-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-29
相关资源
最近更新 更多