csdn产品小助手 2017-08-25 03:27 采纳率: 0%
浏览 60

Yahoo YQL RSS-错误的请求

For making cross-domain AJAX requests with jQuery, I am trying to use YQL RSS.

select * from rss where url='https://www.top1000funds.com/feed/most-popular-posts/'

My code:

var feed = "https://www.top1000funds.com/feed/most-popular-posts/";
var yql = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20rss%20where%20url%3D%22"+encodeURIComponent(feed)+"%22&format=json&diagnostics=true&callback=&rnd=_"+event.timeStamp;
console.log(yql);

$.getJSON(yql, function(res) {
    var html = '<div class="feedListWrap">';
    if(res.query && res.query.results && res.query.results.item){
        //code goes here
    } else {
        html += '<div class="feedEmpty">The feed is currently not available due to server issues. Check back soon!</div>';
    }
    html += '</div>';
    rssWrap.append(html);
}, "jsonp");

It worked fine but now I got Bad Request issue on the json response without a text description of the error:

{"query":{"count":0,"created":"2017-08-25T03:09:09Z","lang":"en","diagnostics":{"publiclyCallable":"true","url":{"execution-start-time":"0","execution-stop-time":"2","execution-time":"2","http-status-code":"400","http-status-message":"Bad Request","content":"https://www.top1000funds.com/feed/most-popular-posts/"},"user-time":"2","service-time":"2","build-version":"2.0.164"},"results":null}}

You can test with the url query: link

When trying to check in YQL console, it works fine:

{
 "query": {
  "count": 10,
  "created": "2017-08-25T02:54:38Z",
  "lang": "en-US",
  "diagnostics": {
   "publiclyCallable": "true",
   "url": {
    "execution-start-time": "1",
    "execution-stop-time": "8",
    "execution-time": "7",
    "content": "https://www.top1000funds.com/feed/most-popular-posts/"
   },
   "user-time": "8",
   "service-time": "7",
   "build-version": "2.0.164"
  },
  "results": {
   "item": [
    {
     "title": "OTPP’s private equity revolution",
     "link": "https://www.top1000funds.com/profile/2017/08/03/otpps-private-equity-revolution/",
     "pubDate": "Thu, 03 Aug 2017 06:39:33 +0000",
     "creator": "Sarah Rundell",
     "guid": {
      "isPermaLink": "false",
      "content": "http://www.top1000funds.com/?p=17673"
     },
     "description": "<div class=\"feedThumb\"><img width=\"125\" height=\"125\" src=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2017/08/03163918/jane-rowe_700px-125x125.jpg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" srcset=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2017/08/03163918/jane-rowe_700px-125x125.jpg 125w, https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2017/08/03163918/jane-rowe_700px-150x150.jpg 150w\" sizes=\"(max-width: 125px) 100vw, 125px\" /></div><div class=\"feedExcerpt\">A deep dive into the world-class private capital division of OTPP, led by Jane Rowe, reveals a strategy of buying large direct stakes in companies, and a commitment to innovation.</div>",
     "encoded": "<div class=\"feedThumb\"><img width=\"125\" height=\"125\" src=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2017/08/03163918/jane-rowe_700px-125x125.jpg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" srcset=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2017/08/03163918/jane-rowe_700px-125x125.jpg 125w, https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2017/08/03163918/jane-rowe_700px-150x150.jpg 150w\" sizes=\"(max-width: 125px) 100vw, 125px\" /></div><div class=\"feedExcerpt\">A deep dive into the world-class private capital division of OTPP, led by Jane Rowe, reveals a strategy of buying large direct stakes in companies, and a commitment to innovation.</div>"
    },
    {
     "title": "The value of the Canadian model",
     "link": "https://www.top1000funds.com/analysis/2017/08/08/the-value-of-the-canadian-model/",
     "pubDate": "Tue, 08 Aug 2017 04:53:00 +0000",
     "creator": "AMANDA WHITE",
     "guid": {
      "isPermaLink": "false",
      "content": "http://www.top1000funds.com/?p=17681"
     },
     "description": "<div class=\"feedThumb\"><img width=\"125\" height=\"125\" src=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2016/03/22215806/Keith-Ambachtsheer-Head_Shoulders_Jan-700x500-2016-125x125.jpg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" srcset=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2016/03/22215806/Keith-Ambachtsheer-Head_Shoulders_Jan-700x500-2016-125x125.jpg 125w, https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2016/03/22215806/Keith-Ambachtsheer-Head_Shoulders_Jan-700x500-2016-150x150.jpg 150w\" sizes=\"(max-width: 125px) 100vw, 125px\" /></div><div class=\"feedExcerpt\">A lot has been written about the superiority of the “Canadian model” for managing pensions, but can a value be assigned to this organisational design structure? </div>",
     "encoded": "<div class=\"feedThumb\"><img width=\"125\" height=\"125\" src=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2016/03/22215806/Keith-Ambachtsheer-Head_Shoulders_Jan-700x500-2016-125x125.jpg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" srcset=\"https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2016/03/22215806/Keith-Ambachtsheer-Head_Shoulders_Jan-700x500-2016-125x125.jpg 125w, https://dmmn26wgpgtie.cloudfront.net/wp-content/uploads/2016/03/22215806/Keith-Ambachtsheer-Head_Shoulders_Jan-700x500-2016-150x150.jpg 150w\" sizes=\"(max-width: 125px) 100vw, 125px\" /></div><div class=\"feedExcerpt\">A lot has been written about the superiority of the “Canadian model” for managing pensions, but can a value be assigned to this organisational design structure? </div>"
    },
    ...
   ]
  }
 }
}

Any advice please?

</div>
  • 写回答

3条回答 默认 最新

  • weixin_33711647 2017-08-25 17:28
    关注

    I think this is a problem from the Yahoo YQL end, and not related from the code used or something else. If you refresh the query, he random loads with error or fine.

    I think there is nothing we (users) can do about it. Yahoo need to fix this...

    评论

报告相同问题?

悬赏问题

  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集