如何從 Google 自定義搜索 API 獲得 100 多個結果 (How to get more than 100 results from Google Custom Search API)


問題描述

如何從 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

(by Mahdijrx1301Gegy)

參考文件

  1. How to get more than 100 results from Google Custom Search API (CC BY‑SA 2.5/3.0/4.0)

#google-api #java #google-custom-search #google-api-java-client






相關問題

在 PHP 中壓縮 JSON 字符串並在 Javascript 中解壓縮以進行 Google API 的數據庫查詢 (Compress JSON string in PHP and decompress in Javascript for Database query for Google API)

將 Google Places API 與 MonoTouch 一起使用? (Using Google Places API with MonoTouch?)

如何獲取我的 Gmail 帳戶的個人資料圖片? (How to get the profile picture of my Gmail account?)

google.elements.newsShow 顯示時間不起作用 (google.elements.newsShow display Time not working)

gapi.client.load 未調用回調:console.log 中指定了無效或非法字符串錯誤 (gapi.client.load not calling callback: An invalid or illegal string was specified error in console.log)

Google Developer Console 和已安裝的應用 (Google Developer Console and Installed App)

如何從 Google 自定義搜索 API 獲得 100 多個結果 (How to get more than 100 results from Google Custom Search API)

Pandas / Google Analytics API 身份驗證嘗試給我帶來了一個奇怪的 python 錯誤 (Pandas / Google Analytics API authentication attempt throws me a weird python error)

在 alpha 階段使用谷歌云功能進行生產 (Using a google cloud feature in alpha stage for production)

流量中的 Google Maps Distance Matrix API 持續時間添加返回錯誤結果的所有段 (Google Maps Distance Matrix API duration in traffic adding all segments returning wrong result)

Python 事件集成中的 QML Calendar 和 Google Calendar API (QML Calendar and Google Calendar API in Python events integration)

獲取錯誤 {“error”:“invalid_grant”,“error_description”:“令牌已過期或撤銷。” 來自谷歌 oauth2 API (Getting error { "error" : "invalid_grant", "error_description" : "Token has been expired or revoked." } from Google oauth2 API)







留言討論