使用 AJAX 加载 RSS 提要:Google Feed API 的替代方案? [英] Loading RSS feed with AJAX: alternatives to Google Feed API?
问题描述
我一直在使用 Google Feed API 来加载 RSS Feed,但 Google 似乎关闭了该 API.例如,当我尝试在 http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&q=http%3A 加载纽约时报 RSS 提要时%2F%2Frss.nytimes.com%2Fservices%2Fxml%2Frss%2Fnyt%2FHomePage.xml
,我得到这个回复:
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?
推荐答案
使用 Yahoo 的 YQL API:
Use Yahoo's YQL API:
select * from xml where url = 'https://news.ycombinator.com/rss'
您可以通过向 url 添加 callback
参数来请求 JSONP 提要
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
这篇关于使用 AJAX 加载 RSS 提要:Google Feed API 的替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!