使用AJAX加载RSS提要:Google Feed API的替代方案?

Joe*_*nin 18 javascript api ajax rss jquery

我一直在使用Google Feed API来加载RSS Feed,但看起来谷歌已经关闭了API.例如,当我尝试加载纽约时报RSS源时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": null, "responseDetails": "This API is no longer available.", "responseStatus": 403}
Run Code Online (Sandbox Code Playgroud)

有没有可行的替代方案?

Ton*_*ony 27

使用Yahoo的YQL API:

select * from xml where url = 'https://news.ycombinator.com/rss'
Run Code Online (Sandbox Code Playgroud)

您可以通过向callback网址添加参数来请求JSONP Feed

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
Run Code Online (Sandbox Code Playgroud)

  • @Aaron这是一个让你前进的基本例子:https://gist.github.com/anonymous/7f79807bc6abb00024df (2认同)