Google検索API
Google検索のオーガニック結果、広告、関連検索、ナレッジグラフなどを取得します。engine=google を設定し、クエリ文字列を渡すことで、キャプチャやボット対策を回避した構造化データを取得できます。
Endpoint
Section titled “Endpoint” GET https://serp.shifter.io/v1?engine=google&api_key=YOUR_API_KEY
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | SERP APIキー |
engine | string | yes | google を指定する必要があります |
q | string | yes | 検索クエリ |
cookie | string | no | リクエスト用のカスタムクッキー。URLエンコードが必要です |
tbm | string | no | 検索バーティカル: isch(画像)、vid(動画)、nws(ニュース)、shop(ショッピング) |
sort_by | string | no | 結果を relevance または date で並べ替え |
time_period | string | no | last_hour、last_day、last_week、last_month、last_year、または custom |
time_period_min | string | no | time_period=custom の場合の最小日付。形式は MM/DD/YYYY |
time_period_max | string | no | time_period=custom の場合の最大日付。形式は MM/DD/YYYY |
flatten_results | int | no | 結果をフラット化する場合は 1、それ以外は 0 |
empty_results | int | no | 空の結果を非表示にする場合は 0、表示する場合は 1 |
device | string | no | desktop、mobile、または tablet |
location | string | no | ジオターゲティングの地域名 |
google_domain | string | no | 使用するGoogleドメイン(例: google.co.uk) |
uule | string | no | Googleエンコード形式の位置情報文字列 |
lr | string | no | 言語制限、形式は lang_xx |
hl | string | no | インターフェース言語コード |
gl | string | no | 国コード |
start | int | no | ページネーション用の結果オフセット |
num | int | no | ページごとの結果数 |
ijn | int | no | Google画像検索のページ番号(1ページあたり100画像) |
safe | string | no | セーフサーチ: active または off |
filter | int | no | 類似結果および省略結果のフィルター: オンは 1、オフは 0 |
nfpr | int | no | 自動修正されたクエリを除外する場合は 1、それ以外は 0 |
tbs | string | no | 高度な検索パラメータ(特許、日付など) |
ludocid | string | no | Googleマイビジネスの CID(Place ID) |
lsig | int | no | ナレッジグラフのマップビューを強制表示 |
Example request
Section titled “Example request”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();Example response
Section titled “Example response”{ "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": "..." }}