ScavioScavio
产品定价文档
登录开始使用
  1. 首页
  2. 教程
  3. 如何从 Google SERP 中提取 People Also Ask 数据
教程

如何从 Google SERP 中提取 People Also Ask 数据

拉人还使用 Scavio API 从 Google SERP 响应中提出问题和答案。非常适合内容差距分析和常见问题解答生成。

获取免费API密钥API文档

Google 搜索结果中的“People Also Ask”(PAA)部分显示了用户对某个主题提出的后续问题。这些数据对于内容策略非常有价值——确定您应该在页面上回答哪些相关问题、构建常见问题解答部分以及了解用户意图。当 Google 显示此框时,Scadio API 会在 SERP 响应中包含 people_also_ask 数组。本教程演示如何提取任何关键字的 PAA 数据并将其用于内容差距分析。

前置条件

  • Python 3.8 或更高版本
  • 请求已安装库
  • Scavio API 密钥
  • 对 Python 列表和字典的基本了解

操作指南

步骤 1: 使用 PAA 数据获取 SERP

使用您的关键字发布到 Scavio 端点。当 Google 显示 PAA 框时,响应将包含 people_also_ask 数组。

Python
data = search_google("how does retrieval augmented generation work")
paa = data.get("people_also_ask", [])
print(f"Found {len(paa)} PAA questions")

步骤 2: 打印问题和答案

每个 PAA 项目都包含一个问题、答案片段和源链接。迭代并打印它们。

Python
for item in paa:
    print("Q:", item["question"])
    print("A:", item.get("snippet", "No answer available"))
    print("Source:", item.get("link", ""))
    print()

步骤 3: 提取内容差距分析的问题

建立一个仅包含问题的列表。这些代表您应该考虑在内容中讨论的主题。

Python
questions = [item["question"] for item in paa]
print("Content gaps to address:")
for q in questions:
    print(f"  - {q}")

步骤 4: 导出为 JSON 以供编辑审核

将 PAA 数据保存为 JSON,以便内容团队可以对其进行审核或将其输入到 LLM 中以生成常见问题解答。

Python
import json

with open("paa_data.json", "w") as f:
    json.dump({"keyword": keyword, "questions": paa}, f, indent=2)
print("Saved PAA data to paa_data.json")

Python 示例

Python
import os
import json
import requests

API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"

def get_paa(keyword: str) -> list[dict]:
    r = requests.post(ENDPOINT, headers={"x-api-key": API_KEY},
                      json={"query": keyword, "country_code": "us"})
    r.raise_for_status()
    return r.json().get("people_also_ask", [])

def analyze_content_gaps(keywords: list[str]) -> dict:
    all_questions = {}
    for kw in keywords:
        questions = [item["question"] for item in get_paa(kw)]
        all_questions[kw] = questions
    return all_questions

if __name__ == "__main__":
    keywords = ["vector database", "embedding models 2026"]
    gaps = analyze_content_gaps(keywords)
    print(json.dumps(gaps, indent=2))

JavaScript 示例

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY || "your_scavio_api_key";
const ENDPOINT = "https://api.scavio.dev/api/v1/search";

async function getPAA(keyword) {
  const res = await fetch(ENDPOINT, {
    method: "POST",
    headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({ query: keyword, country_code: "us" })
  });
  const data = await res.json();
  return data.people_also_ask || [];
}

async function main() {
  const keywords = ["vector database", "embedding models 2026"];
  for (const kw of keywords) {
    const paa = await getPAA(kw);
    console.log(`\n${kw}:`);
    paa.forEach(item => console.log(`  Q: ${item.question}`));
  }
}
main().catch(console.error);

预期输出

JSON
{
  "people_also_ask": [
    {
      "question": "What is the difference between RAG and fine-tuning?",
      "snippet": "RAG retrieves external documents at inference time, while fine-tuning...",
      "link": "https://example.com/rag-vs-finetuning"
    },
    {
      "question": "How do vector databases work?",
      "snippet": "Vector databases store high-dimensional embeddings and retrieve...",
      "link": "https://example.com/vector-databases"
    }
  ]
}

相关教程

  • 如何用 Python 获取 Google 搜索结果
  • 如何通过API提取Google知识图谱数据

常见问题

大多数开发者在15到30分钟内完成本教程。您需要一个Scavio API密钥(免费套餐即可)和可用的Python或JavaScript环境。

Python 3.8 或更高版本. 请求已安装库. Scavio API 密钥. 对 Python 列表和字典的基本了解. Scavio API密钥注册即送50个免费积分。

可以。免费套餐注册即送50个积分,完全足够完成本教程并构建一个可运行的原型解决方案。

Scavio提供原生LangChain包(langchain-scavio)、MCP服务器以及适用于任何HTTP客户端的REST API。本教程使用 the raw REST API, 但您可以根据需要适配您选择的框架。

相关资源

Best Of

2026 年最佳基于队列的 SERP API

Read more
Best Of

2026年最佳SERP API

Read more
Glossary

SERP API

Read more
Glossary

SERP API 队列系统

Read more
Comparison

Semrush API vs Raw SERP API

Read more
Solution

从SERP API获取Google Ads数据

Read more

开始构建

拉人还使用 Scavio API 从 Google SERP 响应中提出问题和答案。非常适合内容差距分析和常见问题解答生成。

获取免费API密钥阅读文档
ScavioScavio

面向AI智能体的实时搜索API。搜索所有平台,不仅仅是Google。

产品

  • 功能
  • 定价
  • 控制台
  • 联盟计划

开发者

  • 文档
  • API参考
  • 快速开始
  • MCP集成
  • Python SDK

替代方案

  • Tavily替代方案
  • SerpAPI替代方案
  • Firecrawl替代方案
  • Exa替代方案

工具

  • JSON格式化
  • cURL转代码
  • Token计数器
  • 全部工具

© 2026 Scavio. 保留所有权利。

Featured on TAAFT
服务条款隐私政策