加载RSS提要的AJAX:替代谷歌饲料API? [英] Loading RSS feed with AJAX: alternatives to Google Feed API?

查看:182
本文介绍了加载RSS提要的AJAX:替代谷歌饲料API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用谷歌的API饲料加载RSS源,但它看起来像谷歌已经关闭了API。例如,当我尝试加载纽约时报RSS提要的<$c$c>http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&q=http%3A%2F%2Frss.nytimes.com%2Fservices%2Fxml%2Frss%2Fnyt%2FHomePage.xml,我得到这个答复:

  {responseData:空,responseDetails:这个API不再可用,responseStatus:403}

是否有可行的替代办法?


解决方案

使用雅虎的 YQL API

  SELECT * FROM XML其中,url ='https://news.ycombinator.com/rss

您可以通过添加回调参数的URL

要求JSONP饲料<$p$p><$c$c>https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%20%3D%20'https%3A%2F%2Fnews.ycombinator.com%2Frss'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=mycallback

I've been using the Google Feed API to load RSS feeds, but it looks like Google has shut down the API. For instance, when I try to load the New York Times RSS feed at http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&q=http%3A%2F%2Frss.nytimes.com%2Fservices%2Fxml%2Frss%2Fnyt%2FHomePage.xml, I get this response:

{"responseData": null, "responseDetails": "This API is no longer available.", "responseStatus": 403}

Are there any viable alternatives?

解决方案

Use Yahoo's YQL API:

select * from xml where url = 'https://news.ycombinator.com/rss'

You can request a JSONP feed by adding a callback parameter to the url

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%20%3D%20'https%3A%2F%2Fnews.ycombinator.com%2Frss'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=mycallback

这篇关于加载RSS提要的AJAX:替代谷歌饲料API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆