GoogleCustom API的结果数量 [英] GoogleCustom API number of results

查看:257
本文介绍了GoogleCustom API的结果数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

googlecoustom API如何获得更多的结果,然后10?我认为它只是第一页的结果...当我输入搜索更多然后10我得到这个错误:

这是请求:



https://www.googleapis.com/customsearch/v1?q=Montenegro&cx=002715630024689775911%3Ajczmrpp_vpo&num=10&key= {YOUR_API_KEY}

  num = 10是结果数量


错误请求

- 显示标题 -

错误:{
errors:[
{
domain:global,
reason:invalid ,
message:无效值
}
],
code:400,
message:无效值
}
}


解决方案

可能会从Google Custom Search API获得超过10个结果。
https://developers.google.com/custom-search / v1 / using_rest#query-params
正如您所看到的num参数,您的有效值只有1和10之间。



要获得更多的结果,你应该多次打电话。在每次不同的调用中,将参数'start'的值增加10。这应该做到这一点


How is possible to get more results then 10 with googlecoustom API? I think its just take results from 1st page... when I type to search more then 10 I get this error:

Here is request:

https://www.googleapis.com/customsearch/v1?q=Montenegro&cx=002715630024689775911%3Ajczmrpp_vpo&num=10&key={YOUR_API_KEY}

num=10 is number of results


400 Bad Request

- Show headers -

{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value"
}
],
"code": 400,
"message": "Invalid Value"
}
}

解决方案

Well It is not possible to get more than 10 result from Google Custom Search API. https://developers.google.com/custom-search/v1/using_rest#query-params As You can see for num parameter you valid values are only between 1 and 10 inclusive.

To get more result you should make multiple calls. in each different call, increase the value of parameter 'start' by 10. That should do it

这篇关于GoogleCustom API的结果数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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