Googleは最大級の旅行データアグリゲーターの1つです。本ドキュメントでは、Googleからリアルタイムのホテルデータをスクレイピングする方法を2つご紹介します。
- 無料スクレイパー:小規模なニーズに最適です。
- Bright Data Google Hotels API:単一のAPIコールで公開されているGoogle Hotelsデータを大規模に収集できるエンタープライズ向けソリューションです(SERP Scraping APIの一部です)。
- Free Scraper
- Bright Data Google Hotels API
- Advanced Features
- Alternative Solutions
- Support & Resources
小規模にGoogle Hotelsデータを抽出するための、素早く簡単なスクレイパーです。
要件:
- Python 3.9+
- ブラウザ自動化のための Selenium
- HTML解析のための BeautifulSoup
pandas、tqdm、webdriver-managerなどの補助ライブラリ
インストール:
pip install pandas tqdm selenium beautifulsoup4 webdriver-managerNote: Webスクレイピングが初めての場合は、初心者向けPython Webスクレイピングチュートリアル または Seleniumを使ったWebスクレイピングガイド から始めることをおすすめします。
必要なパラメータを指定して、google-hotels-scraper.py スクリプトを実行します。
python3 google-hotels-scraper.py --location "Dubai" --max_hotels 200Parameters:
location– ホテルデータの対象ロケーションmax_hotels– スクレイピングするホテル数
💡 Pro Tip: Googleのアンチスクレイピングシステムによる検知を抑えるために、スクリプト内の options.add_argument("--headless=new") の行をコメントアウトしてください。
無料スクレイパーにはいくつかの制約があります。
- IPブロックの高いリスク
- リクエスト量の制限
- CAPTCHAの頻発
- 大規模スクレイピングには不向き(信頼性が低い)
より大規模で信頼性の高いデータ収集には、以下のBright Dataの専用ソリューションをご検討ください 👇
Bright DataのGoogle Hotels API は SERP Scraping API の一部であり、当社の高度な プロキシネットワーク を使用します。CAPTCHAやIPブロックを心配することなく、公開されているGoogle Hotelsデータを大規模に収集できます。
- グローバルなロケーション精度:結果を特定のロケーションに合わせて調整できます
- Pay-Per-Successモデル:成功したリクエストに対してのみ課金されます
- リアルタイムデータ:最新のホテル情報を数秒で取得できます
- スケーラビリティ:ボリューム制限なしで無制限のリクエストを処理できます
- コスト効率:インフラおよびメンテナンスコストを削減できます
- 高い信頼性:内蔵のブロック回避対策により一貫したパフォーマンスを提供します
- 24/7サポート:必要なときにいつでも専門家がサポートします
- Bright Dataアカウント を作成します(新規ユーザーは$5のクレジットが付与されます)
- API key を生成します
- ステップバイステップガイド に従ってSERP APIとアクセス認証情報を設定します
- Google Hotels APIを使用するには、クエリしたいホテルのentity IDが必要です。これは次の手順で確認できます。
- Googleでホテル名を検索します
- 右クリックして「ページのソースを表示」を選択します
- ページ内で「/entity」を検索し、entity IDを見つけます
APIエンドポイントに直接リクエストします。
cURL Example:
curl https://api.brightdata.com/request \
-H "Content-Type: application/json" \
-H "Authorization: Bearer API_TOKEN" \
-d '{
"zone": "ZONE_NAME",
"url": "https://www.google.com/travel/hotels/entity/CgoIyNaqqL33x5ovEAE/prices?brd_json=1",
"format": "raw"
}'Python Example:
import requests
import json
url = "https://api.brightdata.com/request"
headers = {"Content-Type": "application/json", "Authorization": "Bearer API_TOKEN"}
payload = {
"zone": "ZONE_NAME",
"url": "https://www.google.com/travel/hotels/entity/CgoIyNaqqL33x5ovEAE/prices?brd_json=1",
"format": "raw",
}
response = requests.post(url, headers=headers, json=payload)
with open("serp-direct-api.json", "w") as file:
json.dump(response.json(), file, indent=4)
print("Response saved to 'serp-direct-api.json'.")👉 完全なJSON出力 をご覧ください。
Note: 解析済みJSONには brd_json=1 を、解析済みJSON + 完全なネストHTMLには brd_json=html を使用してください。
Bright Dataのプロキシルーティング方式も使用できます。
cURL Example:
curl -i \
--proxy brd.superproxy.io:33335 \
--proxy-user "brd-customer-<customer-id>-zone-<zone-name>:<zone-password>" \
-k \
"https://www.google.com/travel/hotels/entity/CgoIyNaqqL33x5ovEAE/prices?brd_json=html"Python Example:
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
host = "brd.superproxy.io"
port = 33335
username = "brd-customer-<customer-id>-zone-<zone-name>"
password = "<zone-password>"
proxy_url = f"http://{username}:{password}@{host}:{port}"
proxies = {"http": proxy_url, "https": proxy_url}
url = "https://www.google.com/travel/hotels/entity/CgoIyNaqqL33x5ovEAE/prices?brd_json=html"
response = requests.get(url, proxies=proxies, verify=False)
with open("serp-native-proxy.html", "w", encoding="utf-8") as file:
file.write(response.text)
print("Response saved to 'serp-native-proxy.html'.")👉 完全なJSON出力 をご覧ください。
Note: 本番環境では、SSL Certificate Guide に記載のとおり、Bright DataのSSL証明書を読み込んでください。
Bright DataのAPIは、Google Hotelsデータ抽出を微調整するための多くの高度なパラメータをサポートしています。以下は Native Proxy-Based Access を使用した例ですが、Direct API Accessでも適用できます。
これらのパラメータは、検索の国と言語を定義します。
| Parameter | Description | Example |
|---|---|---|
| gl | 2文字の国コード | gl=us (United States) |
| hl | 2文字の言語コード | hl=en (English) |
Example: アメリカ合衆国でホテルを検索し、結果を英語で表示します。
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
"https://www.google.com/travel/hotels/entity/CgoI4NzJmsPmkpU6EAE/prices?gl=us&hl=en"これらのパラメータは、日付、宿泊者数、無料キャンセル、宿泊タイプに基づいて結果を絞り込むのに役立ちます。
| Parameter | Description | Format | Example |
|---|---|---|---|
| brd_dates | チェックイン日およびチェックアウト日 | YYYY-MM-DD,YYYY-MM-DD | brd_dates=2025-08-15,2025-08-20 |
| brd_occupancy | 宿泊者数(大人 + 子ども) | <adults>,<child1_age>,<child2_age> |
brd_occupancy=3,6,9 (大人3名、子ども2名(6歳・9歳)) |
| brd_free_cancellation | 返金可能な予約のみ表示します | true or false | brd_free_cancellation=true |
| brd_accomodation_type | 滞在タイプ | hotels or vacation_rentals | brd_accomodation_type=vacation_rentals |
| brd_currency | 価格表示の通貨 | 3文字の通貨コード | brd_currency=GBP (British Pounds) |
Example: 特定のパラメータを指定してホテル滞在を検索します。
curl --proxy brd.superproxy.io:33335 \
--proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
"https://www.google.com/travel/hotels/entity/CgoIyNaqqL33x5ovEAE/prices\
?brd_dates=2025-04-15,2025-04-20\
&brd_occupancy=3,6,9\
&brd_free_cancellation=true\
&brd_currency=GBP"デフォルトでは、リクエストはデスクトップのuser-agentを模倣しますが、モバイルに変更できます。
| Parameter | Description |
|---|---|
brd_mobile=0 |
ランダムなデスクトップuser-agent(デフォルト) |
brd_mobile=1 |
ランダムなモバイルuser-agent |
brd_mobile=ios |
iPhone user-agent |
brd_mobile=android |
Android phone user-agent |
brd_mobile=ipad |
iPad user-agent |
brd_mobile=android_tablet |
Android tablet user-agent |
Example: Android phone user-agentでホテルデータを取得します。
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
"https://www.google.com/travel/hotels/entity/CgoIyNaqqL33x5ovEAE/prices?brd_mobile=android"デフォルトではレスポンスはHTMLですが、JSONレスポンスを要求できます。
| Parameter | Description |
|---|---|
brd_json=1 |
HTMLの代わりにJSONレスポンスを返します |
brd_json=html |
JSON + 完全なネストHTML |
Example: JSON形式でホテルの価格データを取得します。
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
"https://www.google.com/travel/hotels/entity/CgoIyNaqqL33x5ovEAE/prices?brd_json=1"Web Scraper APIs に加えて、Bright Dataは旅行業界のニーズに合わせた、すぐに使える データセット も提供しています。
- Hotel Datasets
- Airbnb Dataset
- Expedia Datasets
- Tourism Datasets
- Booking.com Datasets
- TripAdvisor Datasets
- Documentation: SERP API Docs
- Explore Related Guides:
- Helpful Articles:
- Use Cases:
- Contact: お困りですか?support@brightdata.com までメールでお問い合わせください




