Google検索API
Google検索のオーガニック結果、広告、関連検索、ナレッジグラフなどを取得します。engine=google を設定し、クエリ文字列を渡すことで、キャプチャやボット対策を回避した構造化データを取得できます。
エンドポイント
Section titled “エンドポイント” GET https://serp.shifter.io/v1?engine=google&api_key=YOUR_API_KEY
パラメーター
Section titled “パラメーター”| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
api_key | string | はい | SERP APIキー |
engine | string | はい | google を指定する必要があります |
q | string | はい | 検索クエリ |
cookie | string | いいえ | リクエスト用のカスタムクッキー。URLエンコードが必要です |
tbm | string | いいえ | 検索バーティカル: isch(画像)、vid(動画)、nws(ニュース)、shop(ショッピング) |
sort_by | string | いいえ | 結果を relevance または date で並べ替え |
time_period | string | いいえ | last_hour、last_day、last_week、last_month、last_year、または custom |
time_period_min | string | いいえ | time_period=custom の場合の最小日付。形式は MM/DD/YYYY |
time_period_max | string | いいえ | time_period=custom の場合の最大日付。形式は MM/DD/YYYY |
flatten_results | int | いいえ | 結果をフラット化する場合は 1、それ以外は 0 |
empty_results | int | いいえ | 空の結果を非表示にする場合は 0、表示する場合は 1 |
device | string | いいえ | desktop、mobile、または tablet |
location | string | いいえ | ジオターゲティングの地域名 |
google_domain | string | いいえ | 使用するGoogleドメイン(例: google.co.uk) |
uule | string | いいえ | Googleエンコード形式の位置情報文字列 |
lr | string | いいえ | 言語制限、形式は lang_xx |
hl | string | いいえ | インターフェース言語コード |
gl | string | いいえ | 国コード |
start | int | いいえ | ページネーション用の結果オフセット |
num | int | いいえ | ページごとの結果数 |
ijn | int | いいえ | Google画像検索のページ番号(1ページあたり100画像) |
safe | string | いいえ | セーフサーチ: active または off |
filter | int | いいえ | 類似結果および省略結果のフィルター: オンは 1、オフは 0 |
nfpr | int | いいえ | 自動修正されたクエリを除外する場合は 1、それ以外は 0 |
tbs | string | いいえ | 高度な検索パラメータ(特許、日付など) |
ludocid | string | いいえ | Googleマイビジネスの CID(Place ID) |
lsig | int | いいえ | ナレッジグラフのマップビューを強制表示 |
リクエスト例
Section titled “リクエスト例”curl "https://serp.shifter.io/v1?engine=google&api_key=YOUR_API_KEY&q=history"import requests
params = { "engine": "google", "api_key": "YOUR_API_KEY", "q": "history",}r = requests.get("https://serp.shifter.io/v1", params=params)data = r.json()import fetch from 'node-fetch';
const url = 'https://serp.shifter.io/v1?' + new URLSearchParams({ engine: 'google', api_key: 'YOUR_API_KEY', q: 'history',});const data = await (await fetch(url)).json();レスポンス例
Section titled “レスポンス例”{ "search_metadata": { "id": "...", "status": "Success", "created_at": "2024-01-01T00:00:00Z" }, "search_parameters": { "engine": "google", "q": "history", "google_domain": "google.com", "device": "desktop" }, "search_information": { "total_results": 10500000000, "time_taken_displayed": 0.52 }, "organic_results": [ { "position": 1, "title": "History - Wikipedia", "link": "https://en.wikipedia.org/wiki/History", "displayed_link": "https://en.wikipedia.org > wiki > History", "snippet": "History is the systematic study of the past..." } ], "related_searches": [ { "query": "world history" } ], "pagination": { "current": 1, "next": "..." }}