Google api google自定义搜索api结果的数量
我使用下面的代码请求谷歌自定义搜索,但我只能得到10个结果每个请求。我知道一定是100。有人知道我应该做些什么来增加这个结果吗Google api google自定义搜索api结果的数量,google-api,google-search,Google Api,Google Search,我使用下面的代码请求谷歌自定义搜索,但我只能得到10个结果每个请求。我知道一定是100。有人知道我应该做些什么来增加这个结果吗 public static void main(String[] args) throws Exception { URL url = new URL( "https://www.googleapis.com/customsearch/v1?key=MY_KEY&cx=013036536707430787589:_pqja
public static void main(String[] args) throws Exception {
URL url = new URL(
"https://www.googleapis.com/customsearch/v1?key=MY_KEY&cx=013036536707430787589:_pqjad5hr1a&q=flowers&alt=json");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
if( output.contains("snippet"))
System.out.println(output);
}
conn.disconnect();
}
从
num
:有效值是介于1和10之间的整数,包括1和10
如果您想要10个以上的结果,则必须使用
start
参数进行分页。非常感谢您的回复,但我如何才能对其进行分页?就像只在一个请求中一样。根据定义,分页基本上是多个请求。如果CSE API足够新,可以支持它,那么您可能可以这样做。