[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-ja-paa-autocomplete-scraping-python-guide":3},{"success":4,"payload":5,"related":68,"errors":135},true,{"id":6,"slug":7,"title":8,"excerpt":9,"body_html":10,"meta_title":11,"meta_description":12,"canonical_url":13,"canonical_override":14,"og_title":11,"og_description":12,"og_image_url":15,"faq_json":16,"key_takeaways":29,"allow_index":35,"noindex_google_only":4,"allow_follow":4,"published_at":36,"updated_at":36,"content_updated_at":37,"featured_image_url":38,"featured_image_alt":39,"card_image_url":40,"reading_time_minutes":41,"author":42,"categories":46,"tags":53,"alternates":54,"locale_paths":66,"views":67},153,"paa-autocomplete-scraping-python-guide","Google People Also AskとAutocompleteのスクレイピングでキーワード調査（Pythonガイド）","GoogleのAutocompleteエンドポイント、People Also Ask、Related Searchesの3つの無料キーワードソースをPythonでスクレイピングし、residential proxyでローカライズされた提案データを取得する実践ガイド。","\u003Cp>Google People Also AskとAutocompleteのスクレイピングでキーワード調査を行うことは、SEO専門家やデベロッパーにとって、有料ツールに頼らずに大量のロングテールキーワードと検索インテントを発見する強力な手法です。本ガイドでは、Pythonを使ってAutocompleteの提案、PAAの質問、Related Searchesを収集し、residential proxyでローカライズされたクリーンなデータを取得する方法を、実行可能なコードとともに解説します。\u003C\u002Fp>\n\n\u003Ch2>3つの無料キーワード金脈：Autocomplete・PAA・Related Searches\u003C\u002Fh2>\n\n\u003Cp>Googleの検索結果ページには、キーワード調査に直結する3つの無料データソースが存在します。それぞれが異なる検索インテントを反映しているため、組み合わせて使うことで包括的なキーワードマップを構築できます。\u003C\u002Fp>\n\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\u003Cth>データソース\u003C\u002Fth>\u003Cth>エンドポイント \u002F 取得方法\u003C\u002Fth>\u003Cth>反映するインテント\u003C\u002Fth>\u003Cth>データ形式\u003C\u002Fth>\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\u003Ctd>Autocomplete（サジェスト）\u003C\u002Ftd>\u003Ctd>\u003Ccode>suggestqueries.google.com\u002Fcomplete\u002Fsearch?client=chrome&q=\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>入力中のリアルタイム検索意図\u003C\u002Ftd>\u003Ctd>JSON（Chrome client）\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>People Also Ask（PAA）\u003C\u002Ftd>\u003Ctd>検索結果ページ内のアコーディオン\u003C\u002Ftd>\u003Ctd>質問形式の情報検索インテント\u003C\u002Ftd>\u003Ctd>HTML（Playwrightで展開）\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Related Searches\u003C\u002Ftd>\u003Ctd>検索結果ページ下部\u003C\u002Ftd>\u003Ctd>関連・派生検索インテント\u003C\u002Ftd>\u003Ctd>HTML\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\u003Cp>Autocompleteは \u003Ca href=\"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FGoogle_Suggest\" rel=\"noopener noreferrer\">Google Suggest\u003C\u002Fa> として知られる機能で、ユーザーが検索バーに入力している最中にリアルタイムの提案を返します。このエンドポイントは \u003Ccode>client=chrome\u003C\u002Fcode> パラメータを指定するとJSON形式で応答するため、スクレイピングに最も適しています。\u003C\u002Fp>\n\n\u003Cp>PAAは検索結果ページに表示される「他の人はこちらも質問」というアコーディオンで、クリックすると回答と出典リンクが展開されます。各質問をクリックすると新しい質問がネストされて追加されるため、再帰的に展開することで数百の質問キーワードを取得できます。\u003C\u002Fp>\n\n\u003Ch2>シードからロングテールへの展開戦略\u003C\u002Fh2>\n\n\u003Cp>1つのシードキーワードから数百のロングテールバリエーションを生成するには、Autocompleteエンドポイントに対して体系的にクエリを送信します。基本戦略は2つです。\u003C\u002Fp>\n\n\u003Ch3>1. a-z展開と修飾子プレフィックス\u003C\u002Fh3>\n\n\u003Cp>シードキーワードの後に \u003Ccode>a\u003C\u002Fcode> から \u003Ccode>z\u003C\u002Fcode> を順に付与してAutocompleteに送信すると、各文字で異なる提案が返ります。さらに \u003Ccode>how to\u003C\u002Fcode>、\u003Ccode>what is\u003C\u002Fcode>、\u003Ccode>best\u003C\u002Fcode>、\u003Ccode>vs\u003C\u002Fcode> などの修飾子プレフィックスを組み合わせることで、1キーワードから200以上のバリエーションを生成できます。\u003C\u002Fp>\n\n\u003Ch3>2. 再帰的PAA展開\u003C\u002Fh3>\n\n\u003Cp>PAAアコーディオンをクリックして展開すると、新しい質問が追加されます。この新しい質問を次のシードとして再帰的に展開することで、階層的に深い質問ツリーを構築できます。\u003C\u002Fp>\n\n\u003Ch2>なぜレート制限とロケールバイアスが発生するのか\u003C\u002Fh2>\n\n\u003Cp>Autocompleteエンドポイントに短時間で大量のリクエストを送ると、Googleのper-IPレート制限により429 Too Many Requestsが返されます。また、同じIPから異なる国のローカライズ提案を取得しようとすると、IPの地理的位置に基づくロケールバイアスが発生し、期待した国の提案が得られません。\u003C\u002Fp>\n\n\u003Cp>これを解決するには、residential proxyでリクエスト元IPを分散させ、かつ国・都市レベルのジオターゲティングを指定する必要があります。ProxyHatのresidential proxyでは、ユーザー名に \u003Ccode>-country-DE-region-state_of_berlin-city-berlin\u003C\u002Fcode> のようなフラグを付与することで、ドイツ・ベルリンの住宅IPからリクエストを送信できます。\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode># ProxyHatのプロキシURL形式（HTTP）\n# 基本形式\nhttp:\u002F\u002FUSERNAME:PASSWORD@gate.proxyhat.com:8080\n\n# 国指定（ドイツ）\nhttp:\u002F\u002Fuser-country-DE:pass@gate.proxyhat.com:8080\n\n# 国・都市指定（ドイツ・ベルリン）\nhttp:\u002F\u002Fuser-country-DE-region-state_of_berlin-city-berlin:pass@gate.proxyhat.com:8080\n\n# セッション固定（sticky session）\nhttp:\u002F\u002Fuser-sid-abc123:pass@gate.proxyhat.com:8080\n\n# SOCKS5形式\nsocks5:\u002F\u002Fuser-country-US:pass@gate.proxyhat.com:1080\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>セッション固定を使うと、同じ仮想セッションIDの間は同じIPが維持されるため、PAA展開のように複数ページにわたるステップフルなスクレイピングでIPの一貫性を保てます。一方、Autocompleteのようなステートレスなリクエストでは、リクエストごとにIPをローテーションすることでレート制限を回避できます。\u003C\u002Fp>\n\n\u003Cp>詳しいロケーション設定は \u003Ca href=\"\u002Fja\u002Flocations\">ProxyHatのロケーション一覧\u003C\u002Fa> を参照してください。プロキシタイプの選択については \u003Ca href=\"\u002Fja\u002Fuse-cases\u002Fweb-scraping\">Webスクレイピングのユースケース\u003C\u002Fa> も参考になります。\u003C\u002Fp>\n\n\u003Ch2>実装例1：httpxでAutocomplete JSONを取得\u003C\u002Fh2>\n\n\u003Cp>まずは最もシンプルなAutocompleteスクレイピングから始めます。\u003Ca href=\"https:\u002F\u002Fplaywright.dev\u002Fpython\u002Fdocs\u002Fintro\" rel=\"noopener noreferrer\">Playwright\u003C\u002Fa> は後述のPAA展開で使いますが、AutocompleteはHTTPリクエストだけでJSONを取得できるため、httpxで十分です。\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>import httpx\nimport json\nimport time\nimport random\n\n# ProxyHatプロキシ設定\nPROXY_BASE = &quot;http:\u002F\u002Fuser-country-{country}:pass@gate.proxyhat.com:8080&quot;\n\ndef fetch_autocomplete(keyword: str, country: str = &quot;US&quot;, region: str = None, city: str = None) -&gt; list[str]:\n    &quot;&quot;&quot;Google Autocompleteからサジェストを取得する&quot;&quot;&quot;\n    username = f&quot;user-country-{country}&quot;\n    if region and city:\n        username += f&quot;-region-{region}-city-{city.lower().replace(&apos; &apos;, &apos;_&apos;)}&quot;\n    elif region:\n        username += f&quot;-region-{region}&quot;\n    proxy_url = f&quot;http:\u002F\u002F{username}:pass@gate.proxyhat.com:8080&quot;\n\n    suggestions = []\n    for attempt in range(3):\n        try:\n            with httpx.Client(\n                proxy=proxy_url,\n                timeout=10.0,\n                headers={\n                    &quot;User-Agent&quot;: &quot;Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36&quot;,\n                    &quot;Accept-Language&quot;: &quot;en-US,en;q=0.9&quot;,\n                },\n            ) as client:\n                resp = client.get(\n                    &quot;https:\u002F\u002Fsuggestqueries.google.com\u002Fcomplete\u002Fsearch&quot;,\n                    params={&quot;client&quot;: &quot;chrome&quot;, &quot;q&quot;: keyword},\n                )\n                resp.raise_for_status()\n                data = resp.json()\n                # data[1] はサジェストのリスト、各要素の[0]がテキスト\n                suggestions = [s[0] for s in data[1]]\n                break\n        except (httpx.HTTPStatusError, httpx.ProxyError, httpx.ConnectError) as e:\n            print(f&quot;Attempt {attempt+1} failed for &apos;{keyword}&apos;: {e}&quot;)\n            time.sleep(2 ** attempt + random.uniform(0, 1))\n    return suggestions\n\n# 使用例\nresults = fetch_autocomplete(&quot;python tutorial&quot;, country=&quot;US&quot;)\nprint(json.dumps(results, indent=2, ensure_ascii=False))\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>curlを使った同等のリクエストは以下の通りです：\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>curl -s --proxy &quot;http:\u002F\u002Fuser-country-US:pass@gate.proxyhat.com:8080&quot; \\\n  &quot;https:\u002F\u002Fsuggestqueries.google.com\u002Fcomplete\u002Fsearch?client=chrome&amp;q=python%20tutorial&quot;\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>実装例2：シードからロングテールへの展開\u003C\u002Fh2>\n\n\u003Cp>1つのシードキーワードを200以上のバリエーションに展開するエクスパンダーを実装します。\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>import string\nimport itertools\nfrom typing import Generator\n\n# 修飾子プレフィックス（検索インテント別）\nPREFIX_MODIFIERS = [\n    &quot;how to&quot;, &quot;what is&quot;, &quot;why&quot;, &quot;when&quot;, &quot;where&quot;, &quot;who&quot;,\n    &quot;best&quot;, &quot;top&quot;, &quot;cheap&quot;, &quot;free&quot;, &quot;review&quot;, &quot;vs&quot;,\n    &quot;buy&quot;, &quot;price&quot;, &quot;cost&quot;, &quot;alternative&quot;, &quot;near me&quot;,\n]\n\n# サフィックス修飾子\nSUFFIX_MODIFIERS = [\n    &quot;tutorial&quot;, &quot;examples&quot;, &quot;guide&quot;, &quot;2025&quot;, &quot;2026&quot;,\n    &quot;alternatives&quot;, &quot;pricing&quot;, &quot;reddit&quot;, &quot;meaning&quot;,\n    &quot;download&quot;, &quot;online&quot;, &quot;course&quot;, &quot;book&quot;,\n]\n\ndef expand_seed(keyword: str) -&gt; list[str]:\n    &quot;&quot;&quot;シードキーワードからロングテールバリエーションを生成&quot;&quot;&quot;\n    queries = [keyword]\n\n    # a-z サフィックス展開\n    for c in string.ascii_lowercase:\n        queries.append(f&quot;{keyword} {c}&quot;)\n\n    # プレフィックス修飾子\n    for m in PREFIX_MODIFIERS:\n        queries.append(f&quot;{m} {keyword}&quot;)\n\n    # サフィックス修飾子\n    for m in SUFFIX_MODIFIERS:\n        queries.append(f&quot;{keyword} {m}&quot;)\n\n    return queries\n\ndef collect_longtail(keyword: str, country: str = &quot;US&quot;) -&gt; set[str]:\n    &quot;&quot;&quot;展開したクエリすべてのAutocompleteを収集&quot;&quot;&quot;\n    all_suggestions = set()\n    queries = expand_seed(keyword)\n    print(f&quot;Generated {len(queries)} seed queries&quot;)\n\n    for i, q in enumerate(queries):\n        suggestions = fetch_autocomplete(q, country=country)\n        all_suggestions.update(suggestions)\n        print(f&quot;[{i+1}\u002F{len(queries)}] &apos;{q}&apos; -&gt; {len(suggestions)} suggestions&quot;)\n        # 礼儀正しいスロットリング\n        time.sleep(random.uniform(0.5, 1.5))\n\n    return all_suggestions\n\n# 実行例\nall_kw = collect_longtail(&quot;python&quot;, country=&quot;US&quot;)\nprint(f&quot;\\nTotal unique keywords: {len(all_kw)}&quot;)\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>1シードから約200クエリを生成し、各クエリで平均10件のサジェストが返るため、理論上は最大2000件のユニークキーワードが得られます。実際には重複が発生するため、ユニーク数は500〜1500件程度になります。\u003C\u002Fp>\n\n\u003Ch2>実装例3：PlaywrightでPAAアコーディオンを展開して質問を抽出\u003C\u002Fh2>\n\n\u003Cp>PAAはJavaScriptで動的にレンダリングされるため、httpxでは取得できません。Playwrightを使ってブラウザを起動し、アコーディオンをクリックして展開します。\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>from playwright.sync_api import sync_playwright\nimport time\n\ndef extract_paa_questions(\n    keyword: str,\n    country: str = &quot;US&quot;,\n    max_clicks: int = 25,\n) -&gt; list[dict]:\n    &quot;&quot;&quot;\n    Google検索結果からPAA質問と回答出典を抽出する\n    戻り値: [{&quot;question&quot;: str, &quot;answer_source&quot;: str}, ...]\n    &quot;&quot;&quot;\n    proxy_url = f&quot;http:\u002F\u002Fuser-country-{country}:pass@gate.proxyhat.com:8080&quot;\n    paa_data = []\n\n    with sync_playwright() as p:\n        browser = p.chromium.launch(\n            proxy={&quot;server&quot;: proxy_url},\n            headless=True,\n        )\n        context = browser.new_context(\n            locale=&quot;en-US&quot;,\n            user_agent=&quot;Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36&quot;,\n        )\n        page = context.new_page()\n\n        try:\n            page.goto(f&quot;https:\u002F\u002Fwww.google.com\u002Fsearch?q={keyword}&quot;, wait_until=&quot;domcontentloaded&quot;)\n            page.wait_for_timeout(2000)\n\n            for click_round in range(max_clicks):\n                # PAA質問要素を取得\n                paa_elements = page.query_selector_all(\n                    &apos;div[jsname=&quot;FW5kfd&quot;] div[role=&quot;button&quot;] span&apos;\n                )\n                if not paa_elements:\n                    # フォールバック: 別のセレクタ\n                    paa_elements = page.query_selector_all(\n                        &apos;[jsname=&quot;CQsKde&quot;] div[role=&quot;button&quot;]&apos;\n                    )\n\n                if click_round &lt; len(paa_elements):\n                    # クリックして展開\n                    paa_elements[click_round].click()\n                    page.wait_for_timeout(1000)\n\n                    # 展開後に全PAA質問を再取得\n                    all_questions = page.query_selector_all(\n                        &apos;div[jsname=&quot;FW5kfd&quot;] div[role=&quot;button&quot;] &gt; span&apos;\n                    )\n\n                    # 回答の出典リンクを取得\n                    source_links = page.query_selector_all(\n                        &apos;div[jsname=&quot;FW5kfd&quot;] a[href]&apos;\n                    )\n\n                    for q_el in all_questions:\n                        q_text = q_el.inner_text().strip()\n                        if q_text and q_text not in [d[&quot;question&quot;] for d in paa_data]:\n                            paa_data.append({\n                                &quot;question&quot;: q_text,\n                                &quot;answer_source&quot;: &quot;&quot;,\n                            })\n\n                    # 出典リンクをマッピング\n                    for link_el in source_links:\n                        href = link_el.get_attribute(&quot;href&quot;)\n                        text = link_el.inner_text().strip()\n                        if href and paa_data:\n                            paa_data[-1][&quot;answer_source&quot;] = href\n\n        except Exception as e:\n            print(f&quot;Error during PAA extraction: {e}&quot;)\n        finally:\n            browser.close()\n\n    return paa_data\n\n# 実行例\npaa_results = extract_paa_questions(&quot;python web scraping&quot;, country=&quot;US&quot;, max_clicks=20)\nfor item in paa_results[:10]:\n    print(f&quot;Q: {item[&apos;question&apos;]}&quot;)\n    print(f&quot;  Source: {item[&apos;answer_source&apos;]}&quot;)\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>実装例4：再帰的PAA展開でネストされた質問を取得\u003C\u002Fh2>\n\n\u003Cp>PAAの質問を次のシードとして再帰的に検索することで、質問の階層ツリーを構築します。\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>def recursive_paa_expansion(\n    seed_keyword: str,\n    country: str = &quot;US&quot;,\n    max_depth: int = 3,\n    max_questions: int = 300,\n) -&gt; list[dict]:\n    &quot;&quot;&quot;\n    PAA質問を再帰的に展開し、深い質問ツリーを構築する\n    &quot;&quot;&quot;\n    all_questions = []\n    seen = set()\n    queue = [(seed_keyword, 0)]  # (keyword, depth)\n\n    while queue and len(all_questions) &lt; max_questions:\n        current_kw, depth = queue.pop(0)\n        if depth &gt; max_depth or current_kw in seen:\n            continue\n        seen.add(current_kw)\n\n        print(f&quot;[depth={depth}] Expanding: {current_kw} ({len(all_questions)}\u002F{max_questions})&quot;)\n\n        paa_items = extract_paa_questions(current_kw, country=country, max_clicks=10)\n\n        for item in paa_items:\n            q = item[&quot;question&quot;]\n            if q and q not in seen:\n                all_questions.append({\n                    &quot;question&quot;: q,\n                    &quot;answer_source&quot;: item.get(&quot;answer_source&quot;, &quot;&quot;),\n                    &quot;seed&quot;: current_kw,\n                    &quot;depth&quot;: depth,\n                })\n                # 各質問を次の展開キューに追加\n                queue.append((q, depth + 1))\n\n        # 礼儀正しいスロットリング\n        time.sleep(random.uniform(1.0, 2.5))\n\n    return all_questions\n\n# 実行例\nexpanded = recursive_paa_expansion(\n    &quot;python web scraping&quot;,\n    country=&quot;US&quot;,\n    max_depth=3,\n    max_questions=300,\n)\nprint(f&quot;\\nTotal PAA questions collected: {len(expanded)}&quot;)\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>実装例5：重複排除・インテントクラスタリング・CSV出力\u003C\u002Fh2>\n\n\u003Cp>収集したAutocompleteとPAAのキーワードを統合し、検索インテントでクラスタリングしてCSVに出力します。\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>import csv\nfrom collections import defaultdict\n\ndef cluster_by_intent(keywords: list[str]) -&gt; dict[str, list[str]]:\n    &quot;&quot;&quot;キーワードを検索インテントでクラスタリング&quot;&quot;&quot;\n    intent_rules = {\n        &quot;informational&quot;: [&quot;what&quot;, &quot;how&quot;, &quot;why&quot;, &quot;when&quot;, &quot;who&quot;, &quot;where&quot;, &quot;which&quot;, &quot;guide&quot;, &quot;tutorial&quot;, &quot;meaning&quot;],\n        &quot;commercial&quot;: [&quot;best&quot;, &quot;top&quot;, &quot;review&quot;, &quot;vs&quot;, &quot;compare&quot;, &quot;alternative&quot;, &quot;vs&quot;],\n        &quot;transactional&quot;: [&quot;buy&quot;, &quot;price&quot;, &quot;cost&quot;, &quot;cheap&quot;, &quot;discount&quot;, &quot;deal&quot;, &quot;pricing&quot;, &quot;free&quot;],\n        &quot;navigational&quot;: [&quot;login&quot;, &quot;sign up&quot;, &quot;official&quot;, &quot;download&quot;, &quot;app&quot;],\n    }\n\n    clusters = defaultdict(list)\n    for kw in keywords:\n        kw_lower = kw.lower().strip()\n        matched = &quot;other&quot;\n        for intent, prefixes in intent_rules.items():\n            if any(kw_lower.startswith(p) or f&quot; {p} &quot; in kw_lower for p in prefixes):\n                matched = intent\n                break\n        clusters[matched].append(kw)\n\n    return dict(clusters)\n\ndef export_to_csv(\n    autocomplete_kw: set[str],\n    paa_items: list[dict],\n    filename: str = &quot;keyword_research.csv&quot;,\n):\n    &quot;&quot;&quot;キーワード調査結果をCSVに出力&quot;&quot;&quot;\n    # Autocompleteキーワード\n    all_kw = list(autocomplete_kw)\n    # PAA質問も追加\n    paa_questions = [item[&quot;question&quot;] for item in paa_items if item[&quot;question&quot;]]\n    all_kw.extend(paa_questions)\n\n    # 重複排除\n    unique_kw = list(set(all_kw))\n\n    # インテントクラスタリング\n    clusters = cluster_by_intent(unique_kw)\n\n    with open(filename, &quot;w&quot;, newline=&quot;&quot;, encoding=&quot;utf-8-sig&quot;) as f:\n        writer = csv.writer(f)\n        writer.writerow([&quot;intent&quot;, &quot;keyword&quot;, &quot;source&quot;, &quot;answer_source&quot;])\n\n        # Autocomplete由来\n        for kw in autocomplete_kw:\n            intent = &quot;other&quot;\n            for i, kws in clusters.items():\n                if kw in kws:\n                    intent = i\n                    break\n            writer.writerow([intent, kw, &quot;autocomplete&quot;, &quot;&quot;])\n\n        # PAA由来\n        for item in paa_items:\n            q = item[&quot;question&quot;]\n            intent = &quot;other&quot;\n            for i, kws in clusters.items():\n                if q in kws:\n                    intent = i\n                    break\n            writer.writerow([intent, q, &quot;paa&quot;, item.get(&quot;answer_source&quot;, &quot;&quot;)])\n\n    print(f&quot;Exported {len(unique_kw)} unique keywords to {filename}&quot;)\n    print(f&quot;Cluster breakdown: {dict((k, len(v)) for k, v in clusters.items())}&quot;)\n\n# 実行例\nexport_to_csv(all_kw, expanded, filename=&quot;python_keyword_research.csv&quot;)\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>並行処理でスループットを向上させる\u003C\u002Fh2>\n\n\u003Cp>Autocompleteリクエストは独立しているため、async\u002Fawaitで並行処理することでスループットを大幅に向上できます。ただし、Googleのレート制限を考慮し、同時接続数は50〜100程度に抑えるべきです。\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>import asyncio\nimport httpx\n\nasync def fetch_autocomplete_async(\n    client: httpx.AsyncClient,\n    keyword: str,\n    semaphore: asyncio.Semaphore,\n) -&gt; list[str]:\n    &quot;&quot;&quot;非同期Autocomplete取得&quot;&quot;&quot;\n    async with semaphore:\n        try:\n            resp = await client.get(\n                &quot;https:\u002F\u002Fsuggestqueries.google.com\u002Fcomplete\u002Fsearch&quot;,\n                params={&quot;client&quot;: &quot;chrome&quot;, &quot;q&quot;: keyword},\n            )\n            resp.raise_for_status()\n            data = resp.json()\n            return [s[0] for s in data[1]]\n        except Exception as e:\n            print(f&quot;Failed for &apos;{keyword}&apos;: {e}&quot;)\n            return []\n\nasync def batch_autocomplete(\n    keywords: list[str],\n    country: str = &quot;US&quot;,\n    max_concurrent: int = 50,\n) -&gt; dict[str, list[str]]:\n    &quot;&quot;&quot;バッチ非同期でAutocompleteを取得&quot;&quot;&quot;\n    proxy_url = f&quot;http:\u002F\u002Fuser-country-{country}:pass@gate.proxyhat.com:8080&quot;\n    semaphore = asyncio.Semaphore(max_concurrent)\n    results = {}\n\n    async with httpx.AsyncClient(\n        proxy=proxy_url,\n        timeout=15.0,\n        headers={&quot;User-Agent&quot;: &quot;Mozilla\u002F5.0&quot;},\n    ) as client:\n        tasks = [fetch_autocomplete_async(client, kw, semaphore) for kw in keywords]\n        responses = await asyncio.gather(*tasks)\n        for kw, suggestions in zip(keywords, responses):\n            results[kw] = suggestions\n\n    return results\n\n# 実行例\nasync def main():\n    seeds = expand_seed(&quot;python&quot;)[:50]  # 最初の50クエリでテスト\n    results = await batch_autocomplete(seeds, country=&quot;US&quot;, max_concurrent=50)\n    total = sum(len(v) for v in results.values())\n    print(f&quot;Collected {total} suggestions from {len(seeds)} queries&quot;)\n\nasyncio.run(main())\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>倫理的配慮とベストプラクティス\u003C\u002Fh2>\n\n\u003Cp>AutocompleteとPAAのデータは公開されている提案データですが、Googleの利用規約と \u003Ca href=\"https:\u002F\u002Fdevelopers.google.com\u002Fcrawling\u002Fdocs\u002Frobots-txt\u002Frobots-txt-spec\" rel=\"noopener noreferrer\">robots.txt\u003C\u002Fa> を尊重すべきです。大規模にスクレイピングする場合は、以下のベストプラクティスに従ってください。\u003C\u002Fp>\n\n\u003Cul>\n\u003Cli>\u003Cstrong>スロットリング:\u003C\u002Fstrong> リクエスト間に0.5〜2秒のランダムな待機を入れる。50並列でも1秒あたり50リクエスト以下に抑える。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>公式APIの優先:\u003C\u002Fstrong> 商用利用や大規模データ収集では、Google Custom Search APIや公式キーワード調査ツールの使用を検討する。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>データの最小化:\u003C\u002Fstrong> 必要なキーワードデータのみを収集し、個人情報や不要なメタデータを保存しない。\u003C\u002Fli>\n\u003Cli>\u003Cstrong>キャッシュの活用:\u003C\u002Fstrong> 同じキーワードの再スクレイピングを避けるため、結果をキャッシュする。\u003C\u002Fli>\n\u003Cli>residential proxyの適切な使用: レート制限回避が目的であり、コンテンツの不正アクセスやToS違反を目的としない。\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cp>ProxyHatのプロキシプランと料金については \u003Ca href=\"\u002Fja\u002Fpricing\">料金ページ\u003C\u002Fa> を参照してください。SERP追跡の用途については \u003Ca href=\"\u002Fja\u002Fuse-cases\u002Fserp-tracking\">SERP追跡のユースケース\u003C\u002Fa> も参考になります。技術的な詳細は \u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\" rel=\"noopener noreferrer\">ProxyHatドキュメント\u003C\u002Fa> をご覧ください。\u003C\u002Fp>\n\n\u003Cp>このガイドの内容は、公開されているGoogleの提案データを活用するものです。本番環境での大規模スクレイピングを行う前に、必ずGoogleの利用規約と該当管轄区域の法律を確認してください。\u003C\u002Fp>","Google PAA・Autocompleteスクレイピングでキーワード調査 | ProxyHat","GoogleのPeople Also AskとAutocompleteをスクレイピングしてキーワード調査を行うPythonガイド。residential proxyでローカライズ提案を取得し、ロングテール展開からCSV出力まで解説。","\u002Fja\u002Fblog\u002Fpaa-autocomplete-scraping-python-guide",null,"https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fpaa-autocomplete-scraping-python-guide-og.webp",[17,20,23,26],{"question":18,"answer":19},"なぜキーワード調査スクレイピングでプロキシが必要なのですか？","AutocompleteエンドポイントやPAA展開で短時間に大量のリクエストを送ると、Googleのper-IPレート制限により429エラーが返されます。また、IPの地理的位置に基づくロケールバイアスにより、期待した国の提案が得られない問題もあります。residential proxyでIPを分散・ローテーションし、国・都市レベルのジオターゲティングを指定することで、レート制限を回避しつつ正確なローカライズデータを取得できます。",{"question":21,"answer":22},"PAAとAutocompleteのスクレイピングに最適なプロキシタイプはどれですか？","residential proxyが最適です。データセンタープロキシはGoogleに検知されやすくブロックされる頻度が高いですが、residential proxyは実際のISPからのIPアドレスを使用するため、検知リスクが低く、ジオターゲティング機能で国・都市レベルのローカライズが可能です。ProxyHatではユーザー名に-country-DE-region-state_of_berlin-city-berlinのようなフラグを指定することで、ドイツ・ベルリンの住宅IPからリクエストを送信できます。",{"question":24,"answer":25},"Googleスクレイピングでブロックを回避するにはどうすればよいですか？","主な対策は4つです。第一に、residential proxyでIPをローテーションし、同一IPでのリクエスト頻度を下げる。第二に、リクエスト間に0.5〜2秒のランダムなスロットリングを入れる。第三に、リアルなUser-AgentヘッダーとAccept-Languageを設定する。第四に、同時接続数を50〜100に抑え、指数バックオフでリトライを実装する。また、PAA展開のようなステップフルなスクレイピングではsticky sessionでIPの一貫性を保つことも重要です。",{"question":27,"answer":28},"AutocompleteとPAAのスクレイピングは合法ですか？","AutocompleteとPAAのデータは公開されている提案データですが、Googleの利用規約とrobots.txtを尊重する必要があります。個人的なキーワード調査や小規模なデータ収集は一般的に行われていますが、商用利用や大規模スクレイピングの場合はGoogle Custom Search APIなどの公式APIの使用を検討すべきです。また、収集したデータの用途について、該当管轄区域の法律（GDPRやCCPAなど）を確認することが重要です。",[30,31,32,33,34],"GoogleのAutocomplete、PAA、Related Searchesを組み合わせることで、無料で包括的なロングテールキーワードと検索インテントを収集できます。","Pythonのhttpxを使ってAutocompleteエンドポイントからJSONを取得し、PlaywrightでPAAアコーディオンを展開して質問を抽出します。","シードキーワードにa-zや修飾子プレフィックスを組み合わせることで、1つのキーワードから数百のバリエーションを生成できます。","レート制限やロケールバイアスを回避するため、residential proxyでIPを分散し、国・都市レベルのジオターゲティングを指定します。","PAAの質問を次のシードとして再帰的に展開することで、階層的に深い質問ツリーを構築できます。",false,"2026-07-14T16:06:25+00:00","2026-10-03T23:53:01+00:00","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fpaa-autocomplete-scraping-python-guide-master.webp","Scrape Google People Also Ask and Autocomplete for Keyword Research (Python Guide)","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fpaa-autocomplete-scraping-python-guide-card.webp",12,{"name":43,"slug":44,"bio":45,"avatar_url":14,"website_url":14,"social_links":14},"ProxyHat Team","proxyhat-team","The ProxyHat editorial team covers proxies, web scraping, and data extraction.",[47],{"id":48,"slug":49,"name":50,"description":14,"meta_title":51,"meta_description":52,"parent_id":14},3,"serp-to-seo","SERPとSEOトラッキング","SERPとSEOトラッキングガイド | ProxyHat ブログ","プロキシを使用したSERPスクレイピングと検索順位追跡のガイド。",[],{"pl":55,"pt":56,"tr":57,"es":58,"it":59,"ja":13,"zh":60,"en":61,"de":62,"fr":63,"ko":64,"ru":65,"x-default":61},"\u002Fpl\u002Fblog\u002Fscrape-people-also-ask-autocomplete-python","\u002Fpt\u002Fblog\u002Fraspar-people-also-autocomplete-python-1","\u002Ftr\u002Fblog\u002Fgoogle-paa-autocomplete-kazima-rehberi","\u002Fes\u002Fblog\u002Fscrapear-people-also-autocomplete-keyword-research","\u002Fit\u002Fblog\u002Fscraping-people-also-ask-autocomplete-python","\u002Fcn\u002Fblog\u002Fzhuaqu-google-paa-zidongbuchquan-guanjianci","\u002Fblog\u002Fscrape-google-paa-autocomplete-keyword-research-1","\u002Fde\u002Fblog\u002Fpeople-also-ask-autocomplete-scrapen","\u002Ffr\u002Fblog\u002Fscraper-google-paa-autocomplete-python-1","\u002Fko\u002Fblog\u002Fgoogle-paa-autocomplete-scraping-python-1","\u002Fru\u002Fblog\u002Fskrejping-google-paa-autocomplete-python",{"pl":55,"pt":56,"tr":57,"es":58,"it":59,"ja":13,"zh":60,"en":61,"de":62,"fr":63,"ko":64,"ru":65},148,[69,85,102,119],{"id":70,"slug":71,"title":72,"excerpt":73,"featured_image_url":74,"featured_image_alt":75,"card_image_url":76,"og_image_url":77,"published_at":78,"updated_at":78,"content_updated_at":79,"reading_time_minutes":41,"is_featured":35,"indexable":35,"views":80,"author":81,"categories":82,"tags":84},198,"geo-targeted-serp-scraping-guide","ジオターゲティングSERPスクレイピングのベストプラクティス：uule\u002Fgl\u002Fhlと都市別IPローテーション実装ガイド","同じキーワードでも地域ごとにGoogle検索結果が変わる理由と、uuleパラメータ・gl・hl・都市レベルのレジデンシャルプロキシを組み合わせたジオターゲティングSERPスクレイピングのベストプラクティスを解説します。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fgeo-targeted-serp-scraping-guide-master.webp","Geo-Targeted SERP Scraping Best Practices for Local SEO Data","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fgeo-targeted-serp-scraping-guide-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fgeo-targeted-serp-scraping-guide-og.webp","2026-07-31T16:11:16+00:00","2026-10-03T23:52:59+00:00",76,{"name":43,"slug":44,"bio":45,"avatar_url":14,"website_url":14,"social_links":14},[83],{"id":48,"slug":49,"name":50,"description":14,"meta_title":51,"meta_description":52,"parent_id":14},[],{"id":86,"slug":87,"title":88,"excerpt":89,"featured_image_url":90,"featured_image_alt":91,"card_image_url":92,"og_image_url":93,"published_at":94,"updated_at":94,"content_updated_at":95,"reading_time_minutes":96,"is_featured":35,"indexable":35,"views":97,"author":98,"categories":99,"tags":101},155,"amazon-keyword-rank-tracking-proxy-1","プロキシを使ったAmazonキーワード順位追跡：開発者向け完全ガイド","Amazonの検索結果は独自のSERPを持ち、関連性と販売速度でランキングが決まります。本記事では、Pythonとプロキシを使ってASINごとのオーガニック順位を追跡する実装方法を解説します。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Famazon-keyword-rank-tracking-proxy-1-master.webp","Amazon Keyword Rank Tracking with Proxies: A Developer's Guide","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Famazon-keyword-rank-tracking-proxy-1-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Famazon-keyword-rank-tracking-proxy-1-og.webp","2026-07-16T16:05:31+00:00","2026-10-03T08:21:32+00:00",13,115,{"name":43,"slug":44,"bio":45,"avatar_url":14,"website_url":14,"social_links":14},[100],{"id":48,"slug":49,"name":50,"description":14,"meta_title":51,"meta_description":52,"parent_id":14},[],{"id":103,"slug":104,"title":105,"excerpt":106,"featured_image_url":107,"featured_image_alt":108,"card_image_url":109,"og_image_url":110,"published_at":111,"updated_at":111,"content_updated_at":112,"reading_time_minutes":113,"is_featured":35,"indexable":35,"views":114,"author":115,"categories":116,"tags":118},154,"google-ai-overviews-burando-tuizhu","Google AI Overviewsでブランドを追跡する方法：戦略的フレームワーク","Google AI Overviewsの引用シェアを追跡するための実践ガイド。プロキシを活用したDIYパイプライン構築、ベンダーツール比較、ガバナンスまで網羅した戦略的アプローチをSEOリードとデータPM向けに解説。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fgoogle-ai-overviews-burando-tuizhu-master.webp","How to Track Your Brand in Google AI Overviews: A Strategic Guide for SEO & Data Teams","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fgoogle-ai-overviews-burando-tuizhu-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fgoogle-ai-overviews-burando-tuizhu-og.webp","2026-07-14T10:05:37+00:00","2026-10-03T23:01:45+00:00",10,78,{"name":43,"slug":44,"bio":45,"avatar_url":14,"website_url":14,"social_links":14},[117],{"id":48,"slug":49,"name":50,"description":14,"meta_title":51,"meta_description":52,"parent_id":14},[],{"id":120,"slug":121,"title":122,"excerpt":123,"featured_image_url":124,"featured_image_alt":125,"card_image_url":126,"og_image_url":127,"published_at":128,"updated_at":128,"content_updated_at":129,"reading_time_minutes":41,"is_featured":35,"indexable":35,"views":130,"author":131,"categories":132,"tags":134},152,"python-rank-tracker-residential-proxies","レジデンシャルプロキシでPythonのGoogleランキングトラッカーを構築する","curl_cffiとProxyHat SDKを使って、GoogleのTLSフィンガープリントとIPレピュテーションを回避しながらSERPを取得し、キーワードごとの順位履歴をSQLiteに保存する本番対応ランクトラッカーの構築手順を解説します。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fpython-rank-tracker-residential-proxies-master.webp","Build a Google Rank Tracker in Python with Residential Proxies","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fpython-rank-tracker-residential-proxies-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fja\u002Fpython-rank-tracker-residential-proxies-og.webp","2026-07-02T16:04:58+00:00","2026-10-03T08:57:47+00:00",58,{"name":43,"slug":44,"bio":45,"avatar_url":14,"website_url":14,"social_links":14},[133],{"id":48,"slug":49,"name":50,"description":14,"meta_title":51,"meta_description":52,"parent_id":14},[],[]]