Google I/O 2026 宣布了对 AI 概述的重大更改,包括 Gemini 3.5 Flash、重新设计的搜索框和信息代理。这些变化改变了引用的网站以及答案的结构。本教程通过比较每日 SERP 快照来检测 AI 概述的变化,并在引用发生变化或内容发生显着变化时进行标记。
前置条件
- Python 3.8+
- 请求库
- 来自 scavio.dev 的 Scavio API 密钥
- 监控目标关键词
操作指南
步骤 1: 捕捉 AI 概览快照
存储每个关键字的完整 AI 概述内容,以便随时间进行比较。
Python
import os, requests, json, hashlib
from datetime import datetime
API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}
KEYWORDS = ['best search api 2026', 'how to add search to ai agent', 'mcp tools for agents']
def snapshot_ai_overview(keyword):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': keyword, 'country_code': 'us'}, timeout=10).json()
ai = data.get('ai_overview', data.get('answer_box', {}))
organic_top3 = [r.get('link', '') for r in data.get('organic_results', [])[:3]]
featured = data.get('featured_snippet', {})
content_str = json.dumps(ai, sort_keys=True)
return {
'keyword': keyword,
'timestamp': datetime.now().isoformat(),
'has_ai_overview': bool(ai),
'ai_content': ai,
'ai_content_hash': hashlib.md5(content_str.encode()).hexdigest(),
'organic_top3': organic_top3,
'has_featured': bool(featured),
}
today = []
for kw in KEYWORDS:
snap = snapshot_ai_overview(kw)
today.append(snap)
print(f' {kw[:40]:40} | AI: {"yes" if snap["has_ai_overview"] else "no":3} | hash: {snap["ai_content_hash"][:8]}')
print(f'\nSnapshots: {len(today)} | Cost: ${len(KEYWORDS) * 0.005:.3f}')步骤 2: 比较快照以检测变化
将今天的快照与以前的快照进行比较,以找出发生了什么变化。
Python
HISTORY_FILE = 'ai_overview_history.json'
def load_history():
try:
with open(HISTORY_FILE) as f:
return json.load(f)
except FileNotFoundError:
return []
def save_history(history):
with open(HISTORY_FILE, 'w') as f:
json.dump(history, f, indent=2)
def detect_changes(today_snaps, history):
if not history:
print(' First snapshot. No comparison available.')
return []
prev_day = history[-1]
prev_by_kw = {s['keyword']: s for s in prev_day['snapshots']}
changes = []
for snap in today_snaps:
kw = snap['keyword']
prev = prev_by_kw.get(kw)
if not prev:
continue
change = {'keyword': kw, 'changes': []}
if snap['ai_content_hash'] != prev['ai_content_hash']:
change['changes'].append('AI Overview content changed')
if snap['has_ai_overview'] != prev['has_ai_overview']:
status = 'appeared' if snap['has_ai_overview'] else 'disappeared'
change['changes'].append(f'AI Overview {status}')
if snap['organic_top3'] != prev['organic_top3']:
change['changes'].append('Top 3 organic results changed')
if change['changes']:
changes.append(change)
for c in change['changes']:
print(f' CHANGE: {kw[:35]} -> {c}')
if not changes:
print(' No changes detected.')
return changes
history = load_history()
changes = detect_changes(today, history)
history.append({'date': datetime.now().strftime('%Y-%m-%d'), 'snapshots': today})
save_history(history)步骤 3: 生成带有警报的变更报告
总结检测到的变化并标记重大变化以供审查。
Python
def change_report(changes, today_snaps):
print(f'\n{"=" * 60}')
print(f' AI Overview Change Report - {datetime.now().strftime("%Y-%m-%d")}')
print(f' Post Google I/O 2026 Monitoring')
print(f'{"=" * 60}')
print(f'\n Keywords monitored: {len(today_snaps)}')
print(f' Changes detected: {len(changes)}')
ai_count = sum(1 for s in today_snaps if s['has_ai_overview'])
print(f' AI Overviews present: {ai_count}/{len(today_snaps)}')
if changes:
print(f'\n Changes:')
for c in changes:
print(f' {c["keyword"][:40]}')
for ch in c['changes']:
print(f' - {ch}')
# Alert levels
ai_changes = [c for c in changes if any('AI Overview' in ch for ch in c['changes'])]
if ai_changes:
print(f'\n ALERT: {len(ai_changes)} AI Overview structure changes detected.')
print(f' This may indicate post-I/O algorithm updates.')
print(f' Review affected keywords and update content strategy.')
print(f'\n Daily cost: ${len(today_snaps) * 0.005:.3f}')
print(f' Monthly: ${len(today_snaps) * 0.005 * 30:.2f}')
change_report(changes, today)Python 示例
Python
import os, requests, json, hashlib
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}
def snapshot(keyword):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': keyword, 'country_code': 'us'}, timeout=10).json()
ai = data.get('ai_overview', data.get('answer_box', {}))
h = hashlib.md5(json.dumps(ai, sort_keys=True).encode()).hexdigest()[:8]
print(f'{keyword[:40]:40} | AI: {bool(ai)} | hash: {h}')
snapshot('best search api 2026')JavaScript 示例
JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
const data = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: SH,
body: JSON.stringify({ query: 'best search api 2026', country_code: 'us' })
}).then(r => r.json());
const ai = data.ai_overview || data.answer_box || {};
console.log(`AI Overview present: ${Object.keys(ai).length > 0}`);预期输出
JSON
best search api 2026 | AI: yes | hash: 3f8a2b1c
how to add search to ai agent | AI: yes | hash: 9d4e7f2a
mcp tools for agents | AI: no | hash: d41d8cd9
Snapshots: 3 | Cost: $0.015
CHANGE: best search api 2026 -> AI Overview content changed
CHANGE: mcp tools for agents -> AI Overview appeared
============================================================
AI Overview Change Report - 2026-05-21
Post Google I/O 2026 Monitoring
============================================================
Keywords monitored: 3
Changes detected: 2
AI Overviews present: 2/3
ALERT: 1 AI Overview structure changes detected.
Daily cost: $0.015
Monthly: $0.45