How to get more than 100 results from Google Custom Search API

寵の児 提交于 2020-01-22 23:06:10

问题


I am trying to use Google Custom Search API for research purposes in Java. As a result I'm gonna need a big result set for each query. However it seems that I'm limited with first 100 results which is much less than what I need. I use the list method like this:

list.setStart(90L);

And when I set it to start from index 100 I get this error:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request

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

Is there any way to remove this limitation?


回答1:


There's a difference between two limitations: a) max 100 queries per day; and b) max 100 results per searched phrase (even split into 10 queries of 10 results per query). The limitation (a) can be solved by paying to Google, whereas limitation (b) cannot be solved at all, it seems to be a feature of the CSE product when searching the whole web (i.e. not just a site search, which can give more results), see e.g. https://productforums.google.com/forum/#!topic/customsearch/VM8_6trCxGU




回答2:


You can only request 10 results per query with Google Custom Search, so you'd want to split up that search into multiple queries. (I don't know how your actual query code works so I don't know if you already know this)

Google Custom Search (Free) also has a limit of 100 queries per day, so if you want more, you'd have to pay.

You can find the pricing here: https://developers.google.com/custom-search/json-api/v1/overview




回答3:


You can use lowRange and highRange to solve this problem. See: https://productforums.google.com/forum/#!topic/customsearch/2qilVDaCz0A



来源:https://stackoverflow.com/questions/34031557/how-to-get-more-than-100-results-from-google-custom-search-api

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