問題描述
如何從 Google 自定義搜索 API 獲得 100 多個結果 (How to get more than 100 results from Google Custom Search API)
我正在嘗試使用 Google 自定義搜索 API 進行 Java 研究。因此,我需要為每個查詢提供一個大的結果集。但是,我似乎受到前 100 個結果的限制,這比我需要的要少得多。我使用這樣的列表方法:
list.setStart(90L);
當我將它設置為從索引 100 開始時,我得到了這個錯誤:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{ "code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Invalid Value",
"reason" : "invalid"
} ],
"message" : "Invalid Value"
}
有沒有辦法消除這個限制?
p>參考解法
方法 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