ScavioScavio
产品定价文档
登录开始使用
  1. 首页
  2. 教程
  3. 如何从 SERP 响应中提取 Google AI 概述
教程

如何从 SERP 响应中提取 Google AI 概述

使用 Scavio API 从 SERP 响应中提取 Google AI 概述摘要。访问 ai_overview 字段以了解 Google 如何总结您的主题。

获取免费API密钥API文档

Google AI 概述(以前称为搜索生成体验)出现在许多信息查询的搜索结果顶部。他们将多个来源总结为一个简洁的答案,在有机结果之前可见。对于 SEO 专业人士和内容策略师来说,了解查询是否会触发 AI 概述及其内容对于了解流量影响变得越来越重要。当 Google 生成 SERP 响应时,Scadio API 会在 SERP 响应中返回 ai_overview 字段。本教程展示如何检测和提取 AI 概述内容。

前置条件

  • Python 3.8 或更高版本
  • 请求已安装库
  • Scavio API 密钥
  • 了解 SERP 功能和 SEO 基础知识

操作指南

步骤 1: 查询触发AI概览的主题

诸如“X 是如何工作的”或“Y 是什么”之类的信息查询通常会触发人工智能概述。将此类查询提交到 Scavio 端点。

Python
data = search_google("how does retrieval augmented generation work")
ai_overview = data.get("ai_overview")
print("AI Overview present:", ai_overview is not None)

步骤 2: 提取摘要文本

ai_overview 对象包含文本摘要和可选的引用来源列表。

Python
if ai_overview:
    print("Summary:")
    print(ai_overview.get("text", "No text available"))
    print("\nSources:")
    for source in ai_overview.get("sources", []):
        print(f"  - {source.get('title')}: {source.get('link')}")

步骤 3: 检查哪些查询触发 AI 概述

运行一批查询并报告哪些查询具有 AI 概述。这有助于确定 Google 正在总结哪些内容领域。

Python
def check_ai_overviews(queries: list[str]) -> dict:
    results = {}
    for q in queries:
        data = search_google(q)
        results[q] = data.get("ai_overview") is not None
    return results

步骤 4: 保存 AI 概述数据以供分析

将 AI 概述内容和引用的来源保留为 JSON 以便进一步分析。

Python
import json

overviews = {}
for q in queries:
    data = search_google(q)
    if data.get("ai_overview"):
        overviews[q] = data["ai_overview"]

with open("ai_overviews.json", "w") as f:
    json.dump(overviews, f, indent=2)

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 search_google(q: str) -> dict:
    r = requests.post(ENDPOINT, headers={"x-api-key": API_KEY},
                      json={"query": q, "country_code": "us"})
    r.raise_for_status()
    return r.json()

def extract_ai_overviews(queries: list[str]) -> dict:
    results = {}
    for q in queries:
        data = search_google(q)
        ai = data.get("ai_overview")
        results[q] = {"has_overview": ai is not None, "text": ai.get("text") if ai else None}
    return results

if __name__ == "__main__":
    queries = ["how does vector search work", "what is rag in ai", "python vs javascript 2026"]
    overviews = extract_ai_overviews(queries)
    print(json.dumps(overviews, 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 searchGoogle(q) {
  const res = await fetch(ENDPOINT, {
    method: "POST",
    headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({ query: q, country_code: "us" })
  });
  return res.json();
}

async function extractAIOverviews(queries) {
  const results = {};
  for (const q of queries) {
    const data = await searchGoogle(q);
    results[q] = { hasOverview: !!data.ai_overview, text: data.ai_overview?.text || null };
  }
  return results;
}

extractAIOverviews(["how does vector search work", "what is rag in ai"])
  .then(r => console.log(JSON.stringify(r, null, 2)))
  .catch(console.error);

预期输出

JSON
{
  "ai_overview": {
    "text": "Retrieval-Augmented Generation (RAG) is a technique that enhances LLM responses by retrieving relevant documents from an external knowledge base before generating an answer...",
    "sources": [
      { "title": "What is RAG? — AWS", "link": "https://aws.amazon.com/what-is/retrieval-augmented-generation/" },
      { "title": "RAG Explained — LangChain Blog", "link": "https://blog.langchain.dev/rag-explained" }
    ]
  }
}

相关教程

  • 如何用 Python 获取 Google 搜索结果
  • 如何从 Google SERP 中提取 People Also Ask 数据

常见问题

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

Python 3.8 或更高版本. 请求已安装库. Scavio API 密钥. 了解 SERP 功能和 SEO 基础知识. 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

Scavio vs Serper

Read more
Comparison

Brave Search API vs Scavio

Read more

开始构建

使用 Scavio API 从 SERP 响应中提取 Google AI 概述摘要。访问 ai_overview 字段以了解 Google 如何总结您的主题。

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

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

产品

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

开发者

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

替代方案

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

工具

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

© 2026 Scavio. 保留所有权利。

Featured on TAAFT
服务条款隐私政策