Google Search (via Apify) について
Apify Actorとして、Google Custom Search JSON API互換の形式で、リアルタイムのウェブ検索と画像検索の結果を返します。使い慣れたリクエストパラメーターとレスポンス項目を維持したい開発者やエージェント向けです。
主な機能
- 01Custom Search JSON互換のエンドポイント
- 02ウェブと画像の検索結果
- 03一般的な検索パラメーターに対応
- 04SearXNG互換のレスポンス経路
活用シーン
- 01Custom Search APIのエンドポイント置換
- 02検索クライアントへのGoogle結果提供
- 03画像検索結果のJSON取得
MCP 対応
Apifyのホスト型MCPサーバーから利用でき、MCPクライアントやAIエージェントが検索を実行できます。
設定
リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。
https://mcp.apify.com/?tools=automationnation/google-custom-search-apiclaude mcp add --transport http retracn-google-search https://mcp.apify.com/?tools=automationnation/google-custom-search-api{"mcpServers":{"retracn-google-search":{"type":"http","url":"https://mcp.apify.com/?tools=automationnation/google-custom-search-api"}}}Cursor で開く{"servers":{"retracn-google-search":{"type":"http","url":"https://mcp.apify.com/?tools=automationnation/google-custom-search-api"}}}VS Code で開く{"mcpServers":{"retracn-google-search":{"type":"http","url":"https://mcp.apify.com/?tools=automationnation/google-custom-search-api"}}}{"mcpServers":{"retracn-google-search":{"serverUrl":"https://mcp.apify.com/?tools=automationnation/google-custom-search-api"}}}コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。
https://mcp.apify.com/?tools=automationnation/google-custom-search-api認証が必要ツール
詳細
Google Custom Search JSON API の代替:同じリクエスト、同じ JSON
Google Custom Search API Alternative は、Google が新規顧客への提供を終了し、2027 年 1 月 1 日に廃止する Custom Search JSON API を置き換える Apify Actor です。同じ /customsearch/v1 リクエストに、同じ JSON(title、link、displayLink、snippet を含む items と画像検索)で応答します。ライブの Google 検索結果を基に、1,000 回の検索あたり $5 で、1 日あたりの上限はありません。
料金: 最大 10 件の検索結果で 1,000 回あたり $5(Gold 以上では $4) · 実行する: https://apify.com/automationnation/google-custom-search-api · ガイド: https://retracn.github.io/automationnation-actors/google-custom-search-api/
基本情報
- そのまま置き換えられるエンドポイント:https://www.googleapis.com/customsearch/v1 を https://automationnation--google-custom-search-api.apify.actor/customsearch/v1 に置き換え、key= の代わりに Apify トークン(token=… または Authorization: Bearer)を送信します。
- 同じパラメーター:q、num、start、gl、hl、lr、cr、safe、dateRestrict、siteSearch、exactTerms、excludeTerms、orTerms、fileType、searchType=image とその画像フィルターに対応します。cx は受け付けますが、無視されます。
- Open WebUI:External web search エンジンを選択し、URL に https://automationnation--google-custom-search-api.apify.actor/search、キーに Apify トークンを指定すると、Google PSE が新規顧客への提供を終了した後も Google の検索結果を利用できます。
- AnythingLLM やその他の SearXNG クライアント向けの SearXNG 互換ルート:https://automationnation--google-custom-search-api.apify.actor/searxng?token=YOUR_APIFY_TOKEN は、SearXNG の JSON 形式で Google の検索結果を返します。
- 同じ JSON:kind、queries.request と nextPage、searchInformation、title、htmlTitle、link、displayLink、snippet、htmlSnippet、formattedUrl を含む items[] を返します(画像の item には mime と image.contextLink、width、height、byteSize、thumbnailLink が追加されます)。
- ウェブ検索では Google の「ウェブ」検索結果ビューを使用します。AI による概要、広告、動画やフォーラムのボックスを含まない、ページあたり 10 件の通常の検索結果で、API の返却結果に近い内容です。
- 相違点:ウェブ全体を検索します(siteSearch または site: 演算子でサイトを指定してください)。totalResults は下限値であり、pagemap はなく、リクエストには約 4~10 秒かかります。
- 料金:最大 10 件の検索結果で 1,000 回あたり $5。Google が請求していた料金と同額です。結果がない検索は無料で、1 日あたりの上限はありません。
Custom Search JSON API の代替としてそのまま使う
エンドポイントとキーを変更し、それ以外のコードはそのまま使います。
| 変更前 | 変更後 | |
|---|---|---|
| エンドポイント | https://www.googleapis.com/customsearch/v1 | https://automationnation--google-custom-search-api.apify.actor/customsearch/v1 |
| 認証 | key=YOUR_GOOGLE_KEY&cx=YOUR_ENGINE_ID | token=YOUR_APIFY_TOKEN またはヘッダー Authorization: Bearer YOUR_APIFY_TOKEN |
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)と JavaScript(examples/cse_fetch.mjs)の例は examples/ にあります。レスポンスは API と同じ JSON です:items[].title、link、displayLink、snippet、queries.nextPage、searchInformation。searchType=image にも対応しています。
入力例
{
"queries": [
"best project management software"
],
"maxResultsPerQuery": 10
}
コードから実行する
REST API
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 — examples/python_example.py を参照してください。
# pip install apify-client
from 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 — examples/node_example.mjs を参照してください。
// npm install apify-client
import { 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);
AI エージェントと使う(MCP)
ホスト型 MCP サーバーの URL(Claude、ChatGPT、Cursor、およびリモート MCP に対応するその他のクライアント向け):
https://mcp.apify.com?tools=automationnation/google-custom-search-api
Claude Desktop / Cursor 用のローカル設定 — mcp/claude_desktop_config.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"
}
}
}
}
よくある質問
Custom Search JSON API はいつ動作しなくなりますか? Google は新規顧客への提供を終了しており、既存顧客は 2027 年 1 月 1 日までに代替サービスへ移行する必要があるとしています。
コードを書き換える必要がありますか? いいえ。エンドポイントを https://automationnation--google-custom-search-api.apify.actor/customsearch/v1 に変更し、Google のキーの代わりに Apify API トークンを送信してください。パラメーターと JSON レスポンスはそのままです。
Programmable Search Engine のサイトリストを引き継げますか? cx では引き継げません。cx は無視されます。1 つのサイトを siteSearch として渡すか、クエリ内で複数のサイトを site:a.com OR site:b.com のように指定してください。
料金はいくらですか? 最大 10 件の結果を含む検索 1,000 回あたり $5(Silver では $4.50、Gold 以上では $4)で、1 日あたりの上限はありません。Google では 1 日 100 件の無料検索後、検索 1,000 回あたり $5 が課金されていました。Apify の無料プランには月額 $5 分のクレジットが含まれており、検索約 1,000 回分に相当します。
AutomationNation のその他の情報
- AI 可視性トラッカー — チェックした回答 1 件あたり $0.05(Gold では $0.04)+オプションのレポート 1 件あたり $0.50 · GitHub のサンプル
- Google Jobs スクレイパー — 求人 1,000 件あたり $2(有料プランでは $1.50)+検索 1 件あたり $0.03 · GitHub のサンプル
- YouTube 字幕スクレイパー — 字幕 1,000 件あたり $1.50(Gold 以上では $1.20) · GitHub のサンプル
- Google ショッピングスクレイパー — 商品 1,000 件あたり $1(Gold 以上では $0.80) · GitHub のサンプル
- Google フライトスクレイパー — フライト 1,000 件あたり $0.20(Gold 以上では $0.16) · GitHub のサンプル
- Google ホテルスクレイパー — ホテル 1,000 件あたり $1(Gold 以上では $0.80) · GitHub のサンプル
- Google 広告透明性スクレイパー — 広告 1,000 件あたり $1(Gold 以上では $0.80) · GitHub のサンプル
- Google ニューススクレイパー — 記事 1,000 件あたり $1(Gold 以上では $0.80) · GitHub のサンプル
- Google 画像スクレイパー — 画像 1,000 件あたり $0.25(Gold 以上では $0.20) · GitHub のサンプル
- Google 動画スクレイパー — 動画 1,000 件あたり $1(Gold 以上では $0.80) · GitHub のサンプル
- Google トレンドスクレイパー — キーワードレポート 1,000 件あたり $1(有料プランでは $0.27~$0.90) · トレンド検索 1,000 件あたり $0.50 · GitHub のサンプル
- App Store レビュースクレイパー — レビュー 1,000 件あたり $0.08(有料プランでは $0.05~$0.07) · GitHub のサンプル
- Google Play レビュースクレイパー — レビュー 1,000 件あたり $0.08(有料プランでは $0.05~$0.07) · GitHub のサンプル
- AEO・GEO トラッカー — Google AI Overview 引用チェッカー — キーワード 1 件あたり $0.04(Gold では $0.032)、2026 年 11 月 17 日から実行 1 回あたり $2 が加算されます。2026 年 10 月 16 日まではキーワード 1 件あたり $0.01 · GitHub のサンプル
- Google マップの見込み客スクレイパー — 見込み客 1 件あたり $0.03(Gold では $0.024)。ウェブサイトなし、または未登録のフィルターを使って見つかった事業者 1 件あたり $0.08 · GitHub のサンプル
- 英国版 Google マップの見込み客スクレイパー — 見込み客 1 件あたり $0.05(Gold では $0.04) · GitHub のサンプル
- App Store・Google Play レビュースクレイパー+AI — アプリレポート 1 件あたり $0.05(Gold では $0.04) · GitHub のサンプル
- 英国 Companies House の見込み客 — 登記シグナルと AI によるアウトリーチ — 見込み客 1 件あたり $0.008
- 連絡先情報の段階的エンリッチメント — メールアドレスと取締役 — 企業 1 社あたり $0.015
- すべての Actor とガイド · AI 可視性トラッカーの比較 · Google Jobs スクレイパーの比較 · Google トレンドスクレイパーの比較 · App Store レビュースクレイパーの比較 · Google Play レビュースクレイパーの比較 · YouTube 字幕スクレイパーの比較 · Google フライトスクレイパーの比較 · Google ホテルスクレイパーの比較 · Google 広告透明性スクレイパーの比較 · Google ショッピングスクレイパーの比較 · Google ニューススクレイパーの比較
このリポジトリには使用例が含まれています。スクレイパー自体はApify platform上で動作します。無料のApifyアカウントとAPIトークンが必要です。使用例はMITライセンスです。
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。