Google Search (via Apify)

io.github.retracnv1.0.0更新於 Oct 6, 2026

Google web search for AI agents: title, link and snippet in Custom Search JSON API format.

已驗證Streamable HTTP可網頁執行Developer ToolsWeb Search & Scraping

概覽

AI 產生的概覽

讓助理透過 Apify 執行 Google 網頁與圖片搜尋,並以 Google Custom Search JSON API 格式回傳結果。

功能
以與 Google Custom Search JSON API 相同的 JSON 結構提供 Google 網頁搜尋結果,包含 title、link、displayLink 與 snippet 欄位,並支援圖片搜尋。它是以遠端 MCP 端點形式提供的託管 Apify Actor,同時提供可直接替換的 REST、Open WebUI 與 SearXNG 相容介面。搜尋使用 Google 的純網頁結果檢視,不含 AI Overview、廣告以及影片與論壇區塊。
適用情境
當助理需要即時 Google 搜尋結果時適用,也適合需要替換 Google Custom Search JSON API 端點的現有程式碼或用戶端。適合只需要搜尋摘要而非完整網頁內容的代理情境。
執行需求
使用 mcp.apify.com 上的遠端 MCP 端點,不需要本機執行環境。需要免費的 Apify 帳號與 Apify API 權杖,透過 Authorization 標頭以 Bearer 形式傳送。需要可連線至 Apify 的網路。
安裝前請注意
Authorization 標頭攜帶 Apify API 權杖,這是可計費的憑證,須妥善保密。搜尋以每 1,000 次(每次最多 10 筆結果)5 美元計費,且無每日上限,可能產生費用。查詢內容會傳送給 Apify 與 Google。cx 參數雖被接受但會被忽略,原有網站清單需改用 siteSearch 或 site: 運算子傳入。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Google Search (via Apify),將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "google-search": {
      "type": "http",
      "url": "https://mcp.apify.com/?tools=automationnation/google-custom-search-api"
    }
  }
}

README

Google Custom Search JSON API alternative: same requests, same JSON

[Run on Apify]

Google Custom Search API Alternative is an Apify Actor that replaces Google's Custom Search JSON API, which Google has closed to new customers and retires on 1 January 2027. It answers the same /customsearch/v1 requests with the same JSON (items with title, link, displayLink and snippet, plus image search), built from live Google results, at $5 per 1,000 searches with no daily cap.

Price: $5 per 1,000 searches of up to 10 results ($4 on Gold and above) · Run it: https://apify.com/automationnation/google-custom-search-api · Guide: https://retracn.github.io/automationnation-actors/google-custom-search-api/

Quick facts

  • Drop-in endpoint: replace https://www.googleapis.com/customsearch/v1 with https://automationnation--google-custom-search-api.apify.actor/customsearch/v1 and send your Apify token (token=… or Authorization: Bearer) instead of key=.
  • Same parameters: q, num, start, gl, hl, lr, cr, safe, dateRestrict, siteSearch, exactTerms, excludeTerms, orTerms, fileType and searchType=image with its image filters; cx is accepted and ignored.
  • Open WebUI: pick the External web search engine with URL https://automationnation--google-custom-search-api.apify.actor/search and your Apify token as the key, to keep Google results now that Google PSE is closed to new customers.
  • SearXNG-compatible route for AnythingLLM and other SearXNG clients: https://automationnation--google-custom-search-api.apify.actor/searxng?token=YOUR_APIFY_TOKEN returns Google results in SearXNG's JSON format.
  • Same JSON: kind, queries.request and nextPage, searchInformation and items[] with title, htmlTitle, link, displayLink, snippet, htmlSnippet and formattedUrl (image items add mime and image.contextLink, width, height, byteSize, thumbnailLink).
  • Web searches use Google's "Web" results view: ten plain results per page without the AI Overview, ads or video and forum boxes, close to what the API returned.
  • Differences: it searches the whole web (pass site lists as siteSearch or site: operators), totalResults is a lower bound, there is no pagemap, and a request takes about 4–10 seconds.
  • Price: $5 per 1,000 searches of up to 10 results, the price Google charged; searches with no results are free and there is no daily cap.

Use it as a drop-in Custom Search JSON API

Change the endpoint and the key; keep the rest of your code:

BeforeAfter
Endpointhttps://www.googleapis.com/customsearch/v1https://automationnation--google-custom-search-api.apify.actor/customsearch/v1
Authkey=YOUR_GOOGLE_KEY&cx=YOUR_ENGINE_IDtoken=YOUR_APIFY_TOKEN or header Authorization: Bearer YOUR_APIFY_TOKEN
bash
curl "https://automationnation--google-custom-search-api.apify.actor/customsearch/v1?q=best+crm+for+startups&num=10&token=$APIFY_TOKEN"

Python (examples/cse_requests.py) and JavaScript (examples/cse_fetch.mjs) versions are in examples/. The response is the API's JSON: items[].title, link, displayLink, snippet, queries.nextPage and searchInformation; searchType=image works too.

Example input

json
{  "queries": [    "best project management software"  ],  "maxResultsPerQuery": 10}

Run it from code

REST API

bash
curl -X POST "https://api.apify.com/v2/acts/automationnation~google-custom-search-api/run-sync-get-dataset-items?token=$APIFY_TOKEN" \  -H "Content-Type: application/json" \  -d '{"queries": ["best project management software"], "maxResultsPerQuery": 10}'

Python — see examples/python_example.py

python
# pip install apify-clientfrom apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")run = client.actor("automationnation/google-custom-search-api").call(run_input={  "queries": [    "best project management software"  ],  "maxResultsPerQuery": 10})for item in client.dataset(run["defaultDatasetId"]).iterate_items():    print(item.get("title"), item.get("link"), item.get("displayLink"), item.get("snippet"))

JavaScript — see examples/node_example.mjs

js
// npm install apify-clientimport { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });const run = await client.actor('automationnation/google-custom-search-api').call({  "queries": [    "best project management software"  ],  "maxResultsPerQuery": 10});const { items } = await client.dataset(run.defaultDatasetId).listItems();for (const item of items) console.log(item.title, item.link, item.displayLink, item.snippet);

Use it with AI agents (MCP)

Hosted MCP server URL (Claude, ChatGPT, Cursor and other clients with remote MCP support):

https://mcp.apify.com?tools=automationnation/google-custom-search-api

Local config for Claude Desktop / Cursor — mcp/claude_desktop_config.json:

json
{  "mcpServers": {    "google-custom-search-api": {      "command": "npx",      "args": [        "-y",        "@apify/actors-mcp-server",        "--tools",        "automationnation/google-custom-search-api"      ],      "env": {        "APIFY_TOKEN": "YOUR_APIFY_TOKEN"      }    }  }}

FAQ

When does the Custom Search JSON API stop working? Google closed it to new customers and says existing customers have until 1 January 2027 to move to an alternative.

Do I have to rewrite my code? No. Change the endpoint to https://automationnation--google-custom-search-api.apify.actor/customsearch/v1 and send an Apify API token instead of the Google key; the parameters and the JSON response stay the same.

Can I keep my Programmable Search Engine's site list? Not through cx, which is ignored. Pass one site as siteSearch, or several in the query as site:a.com OR site:b.com.

What does it cost? $5 per 1,000 searches of up to 10 results ($4.50 on Silver, $4 on Gold and above), with no daily cap. Google charged $5 per 1,000 after 100 free queries a day; Apify's free plan includes $5 of monthly credit, about 1,000 searches.

More from AutomationNation


This repository holds usage examples. The scraper itself runs on the Apify platform; you need a free Apify account and API token. Examples are MIT licensed.

來源:README.md,提交 ba93a3c

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v1.0.0最新Oct 6, 2026