How can I make Google News output JSON?

早过忘川 提交于 2020-01-12 05:41:06

问题


I tried using Google's feed to JSON converter like this: http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http%3A%2F%2Fnews.google.com%2Fnews%3Foutput%3Drss%26num%3D8

The only problem is that only a maximum of 4 results can be returned. If I go directly to http://news.google.com/news?output=rss&num=8, then there are 8 results. But if I convert it to JSON, there's only 4.

Is there another method of getting Google News results in the JSON format?


回答1:


&num=8 should be part of the load request, not url encoded.

Like this...

http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=8&q=http%3A%2F%2Fnews.google.com%2Fnews%3Foutput%3Drss




回答2:


you can use rsz parameter

rsz=4

This argument supplies an integer from 1–8 indicating the number of results to return per page. e.g.

 $url="https://ajax.googleapis.com/ajax/services/search/news?v=1.0&rsz=8&q=Tarun%20Gupta";


来源:https://stackoverflow.com/questions/9151734/how-can-i-make-google-news-output-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!