我正在尝试使用谷歌自定义搜索API,我想要做的是搜索前20个结果,我尝试将URL中的num=10
更改为20但是给出了400错误,如何修复或请求第二页结果?(注意我正在使用搜索整个网络)
这是我正在使用的代码
import requests,json
url="https://www.googleapis.com/customsearch/v1?q=SmartyKat+Catnip+Cat+Toys&cx=012572433248785697579%3A1mazi7ctlvm&num=10&fields=items(link%2Cpagemap%2Ctitle)&key={YOUR_API_KEY}"
res=requests.get(url)
di=json.loads(res.text)
不幸的是,无法从Google自定义搜索API收到超过10个结果。但是,如果您确实需要更多结果,则可以通过将start参数增加10来进行多次调用。
看到这个链接:https://developers.google.com/custom-search/v1/using_rest#query-params