到 2026 年,Gemini AI 概述取代了 40% 以上的 Google SERP 上的特色片段。概述中的引用是新的排名第一。本教程使用 Scavio 的 AI 概述提取端点跟踪查询面板的 Gemini AI 概述引用。
前置条件
- Python 3.10+
- Scavio API 密钥
- 具有符合概述条件的查询的查询面板
操作指南
步骤 1: 识别概述触发查询
信息性和比较性查询最能引发概述。
Python
QUERIES = [
'what is an ai agent',
'how does rag work',
'serpapi vs scavio'
]步骤 2: 使用 ai_overview 标志查询 Scavio
Scavio 返回概述内容和引用(如果存在)。
Python
import requests, os
API_KEY = os.environ['SCAVIO_API_KEY']
def get_overview(query):
r = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': API_KEY},
json={'query': query, 'include': ['ai_overview']})
return r.json().get('ai_overview', {})步骤 3: 提取引用 URL
概述响应包括引文数组。
Python
def citations(overview):
return [c['url'] for c in overview.get('citations', [])]步骤 4: 跟踪存在与缺席情况
并非每个查询都能得到概述。记录这两种情况。
Python
def track(query):
ov = get_overview(query)
if not ov:
return {'query': query, 'has_overview': False}
return {'query': query, 'has_overview': True, 'citations': citations(ov)}步骤 5: 计算您的域的覆盖范围
引用您的符合概览条件的查询的百分比。
Python
def coverage(results, domain):
with_ov = [r for r in results if r['has_overview']]
mine = [r for r in with_ov if any(domain in c for c in r.get('citations', []))]
return len(mine) / len(with_ov) if with_ov else 0Python 示例
Python
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
QUERIES = ['what is an ai agent', 'how does rag work']
results = []
for q in QUERIES:
r = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': API_KEY},
json={'query': q, 'include': ['ai_overview']})
ov = r.json().get('ai_overview', {})
if ov:
results.append({'query': q, 'citations': [c['url'] for c in ov.get('citations', [])]})
print(results)JavaScript 示例
JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const QUERIES = ['what is an ai agent', 'how does rag work'];
const results = [];
for (const q of QUERIES) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ query: q, include: ['ai_overview'] })
});
const data = await r.json();
if (data.ai_overview) results.push({ query: q, citations: data.ai_overview.citations?.map(c => c.url) });
}
console.log(results);预期输出
JSON
Per-query list of AI Overview citations. Typical B2B SaaS sees 15-30% of target queries trigger overviews, with 3-5 citations each.