Skip to content

Google Reviewsデータを収集するための強力なソリューションです。小規模プロジェクト向けの無料スクレイパーか、大規模抽出向けのBright DataのエンタープライズAPIのいずれかを選択できます。

Notifications You must be signed in to change notification settings

bright-jp/google-reviews-api

Repository files navigation

Google Reviews API

Promo

このリポジトリでは、Google Reviewsデータを収集するための2つのアプローチを提供しています。

  1. 無料スクレイパー: 小規模プロジェクト、テスト、個人の調査、教育目的向けの軽量ソリューションです。
  2. Bright Data Google Reviews API: エンタープライズレベルでスケーラブルかつ信頼性の高い、大容量のデータ抽出を実現する堅牢なソリューションです。SERP API の一部です。

Table of Contents

Free Scraper

小規模にレビューを抽出したい方向けの、手軽で簡単なスクレイパーです。

scrape-google-reviews-pizza-place

Setup

要件:

  • Python 3.9 以上
  • ブラウザ自動化のための Playwright

インストール:

pip install playwright
playwright install

Webスクレイピングが初めてですか? Pythonで始めるWebスクレイピング入門ガイドをご覧ください。

Quick Start

  1. google-reviews-scraper.py を開き、次の変数を更新します:
    • url – ビジネスのGoogle Maps URLです。
    • target_reviews – スクレイピングするレビュー数です。
  2. スクリプトを実行します。

💡 プロのヒント: HEADLESS = False を設定すると、Googleのアンチスクレイピングシステムによる検知を減らせます。

Sample Output

{
    "reviewer_name": "Christopher Huntley (youcancallmemaurice)",
    "reviewer_link": "https://www.google.com/maps/contrib/116348973042381100705/reviews?hl=en-GB",
    "reviewer_image": "https://lh3.googleusercontent.com/a-/ALV-UjXgKzymRM7WTYFkhDuA2_lN5WfE7EYAoBAFPOf2YGxA1e_s72zD9A=w36-h36-p-rp-mo-ba5-br100",
    "rating": 5,
    "date": "a month ago",
    "text": "We took a local tip for the best pizza in Chicago. It's a dive vibe with a very regimented process. The garlic bread was good and the dipping sauce was a nice touch.\n\nPizza came fairly quickly. A standard deep dish with sausage, onion and pepper. Good crust, good flavor for sauce and toppings were perfect.\n\nService was quick and attentive. A great experience.",
    "photos": [
        "https://lh3.googleusercontent.com/geougc-cs/AIHozJIkCwzdm33OdIVsHIJcqdLPauk-Q3Xk0rRjj4SrzOaiMF1L_uQFW4T7jg86meLyB6So7wsJX0Pk6m8NuxUbUF_1OTvutnqJbmwU2olmmiS5Z1A6puOo8oPD6qqBSG0TXO5KyM_B=w300-h450-p",
        "https://lh3.googleusercontent.com/geougc-cs/AIHozJKiYAPlUmW7O1M79DDjuRgbeOJ92t2IqwuUDOXUFOABH6XBoZet4bGsYV_NxK1z2SkaFLktjjaAs1FoI2XMEwjt9uMZKQX2K904RjyymLZ1SA4LKq_a3vttOPJr7bMTJCpEx-Y=w300-h225-p",
        "https://lh3.googleusercontent.com/geougc-cs/AIHozJKvdP93huqqhLlxZZDv3VKpNYVriS8qq8lKoGiFydTTDAgZOtupYcgxfaSu4KPbE4wX16lD4sXMOY10vLRVk8_mrMe2N4Ul9hX1h46-JJ0rCmZcDcXogMr_YlIDIp_ao_S_wxVQgQ=w300-h225-p"
    ],
    "likes_count": "4"
}

👉 完全なJSON出力をご覧ください。

Limitations

無料スクレイパーには大きな制約があります。

  • IPアドレスがブロックされるリスクが高い
  • リクエスト量が限定的
  • CAPTCHAが頻繁に発生
  • 大規模スクレイピングには信頼性が低い

信頼性の高い大規模なデータ収集には、より高度なソリューションが必要です。

Bright Data Enterprise Solution

Bright Data の Google Reviews API は、高度な機能とスケーラビリティを備えた、構造化されたGoogle Reviewsデータを提供します。SERP API と同じ先進技術で構築されており、次を提供します。

  • グローバルな位置精度: あらゆる場所に合わせて結果を調整できます
  • Pay-Per-Successモデル: 成功したリクエストに対してのみ支払います
  • リアルタイムデータ: 数秒で最新のレビューを取得できます
  • スケーラビリティ: ボリューム制限なしで無制限のリクエストに対応します
  • コスト効率: インフラと保守コストを削減できます
  • 最高の信頼性: ブロッキング回避機能を内蔵し、安定したパフォーマンスを提供します
  • 技術サポート: 必要に応じて専門家の支援を受けられます

Getting Started

  1. 前提条件:
  2. セットアップ: APIを統合するために、ステップバイステップガイドに従ってください
  3. 実装方法:
    • Direct API Access
    • Native Proxy-Based Access

Direct API Access

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/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&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/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&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 を使用します。

Native Proxy-Based Access

プロキシルーティング方式も利用できます。

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/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&brd_json=1"

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/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&brd_json=html"
response = requests.get(url, proxies=proxies, verify=False)

with open("serp-native-proxy.json", "w", encoding="utf-8") as file:
    file.write(response.text)

print("Response saved to 'serp-native-proxy.json'.")

👉 完全なJSON出力をご覧ください。

Note: 本番環境では、SSL Certificate Guideに記載のとおり、Bright Data のSSL証明書を読み込んでください。

Advanced Features

Bright Data のAPIは、レビュー抽出を細かく調整するための複数の高度なパラメータをサポートしています。

Feature ID (fid)

scrape-google-reviews-building

feature ID は、ビジネスまたは場所を識別する一意のIDです。見つける方法は次のとおりです。

  1. ビジネス名でGoogle検索を実行します
  2. 検索結果ページのソースコードを表示します(右クリックして「ページのソースを表示」を選択します)
  3. ページ内で「data-fid」を検索します
  4. fid は次のような形式で表示されます: "fid":"0x89c259a9b3117469:0xd134e199a405a163"

Localization (hl)

google-reviews-scraper-building

2文字の言語コードを使用して、優先言語を指定します。

Example:

curl --proxy brd.superproxy.io:33335 \
     --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
     "https://www.google.com/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&hl=fr"

この例では、フランス語のレビューが返されます。

Sorting and Filtering

クエリパラメータを使用してレビューを並べ替え、フィルタできます。

  1. sort: レビューの並び順を決定します。

    Possible values:

    • sort=qualityScore (default) - 最も関連性の高いレビューから表示します
    • sort=newestFirst - 新しいレビューから表示します
    • sort=ratingHigh - 評価の高いレビューから表示します
    • sort=ratingLow - 評価の低いレビューから表示します

    Example:

    curl --proxy brd.superproxy.io:33335 \
         --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
         "https://www.google.com/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&sort=ratingLow"

    この例では、評価の低いレビューが先に返されます。

  2. filter: 特定のキーワードを含むレビューをフィルタします。

    Example:

    curl --proxy brd.superproxy.io:33335 \
         --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
         "https://www.google.com/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&filter=excellent"

    この例では、「excellent」という単語を含むレビューのみが返されます。

Pagination

次のパラメータで結果数を制御し、ページネーションを管理します。

  1. start: ページネーションを管理するための結果オフセットを定義します。

    • start=0 (default) - 結果の最初のページ
    • start=10 - 結果の2ページ目
    • start=20 - 結果の3ページ目

    Example:

    curl --proxy brd.superproxy.io:33335 \
         --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
         "https://www.google.com/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&start=10"

    この例では、2ページ目のレビューが返されます。

  2. num: 1ページあたりに返す結果数を定義します。

    • num=10 (default) - 10件の結果を返します
    • num=20 - 20件の結果を返します(最大)

    Example:

    curl --proxy brd.superproxy.io:33335 \
         --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
         "https://www.google.com/reviews?fid=0x89c259a9b3117469:0xd134e199a405a163&num=20"

    この例では、1回のリクエストで20件のレビューが返されます。

Support & Resources

About

Google Reviewsデータを収集するための強力なソリューションです。小規模プロジェクト向けの無料スクレイパーか、大規模抽出向けのBright DataのエンタープライズAPIのいずれかを選択できます。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages