Cree un sistema de alerta de cambios en AI Overview que establezca una línea de base del contenido de AI Overview para sus consultas de destino, ejecute búsquedas diarias con análisis de AI Overview, diferencie el contenido actual con respecto a la línea de base y avise cuando se agregan, eliminan citas o cuando el texto del resumen cambia significativamente. La descripción general de IA de Google es ahora una fuente principal de tráfico para muchas consultas y las citas pueden aparecer o desaparecer sin previo aviso. Un sistema de seguimiento automatizado detecta estos cambios en 24 horas en lugar de semanas.
Requisitos previos
- Python 3.8+ instalado
- solicita biblioteca instalada
- Una clave API de Scavio de scavio.dev
- Una lista de consultas de destino para monitorear
Guia paso a paso
Paso 1: Consultas de referencia
Ejecute búsquedas iniciales para establecer una base de referencia del contenido de la descripción general de IA para cada consulta de destino.
import os, requests, json, datetime, hashlib
API_KEY = os.environ['SCAVIO_API_KEY']
QUERIES = [
'best search api for developers',
'how to add search to ai agent',
'serp api comparison 2026',
]
BASELINE_FILE = 'ai_overview_baseline.json'
def fetch_ai_overview(query: str) -> dict:
resp = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': API_KEY},
json={'platform': 'google', 'query': query}, timeout=15)
data = resp.json()
ai = data.get('ai_overview', {})
if isinstance(ai, dict):
return {
'text': ai.get('text', ''),
'citations': ai.get('citations', []),
}
return {'text': str(ai), 'citations': []}
def create_baseline(queries: list) -> dict:
baseline = {}
for q in queries:
overview = fetch_ai_overview(q)
baseline[q] = {
'date': datetime.date.today().isoformat(),
'text_hash': hashlib.md5(overview['text'].encode()).hexdigest(),
'text': overview['text'][:500],
'citations': overview['citations'],
}
print(f'{q}: {len(overview["text"])} chars, {len(overview["citations"])} citations')
with open(BASELINE_FILE, 'w') as f:
json.dump(baseline, f, indent=2)
return baseline
baseline = create_baseline(QUERIES)Paso 2: Búsqueda diaria con análisis de descripción general de IA
Realice búsquedas diarias y analice el contenido actual de la descripción general de IA para compararlo.
def daily_scan(queries: list) -> dict:
current = {}
for q in queries:
overview = fetch_ai_overview(q)
current[q] = {
'date': datetime.date.today().isoformat(),
'text_hash': hashlib.md5(overview['text'].encode()).hexdigest(),
'text': overview['text'][:500],
'citations': overview['citations'],
}
return current
current = daily_scan(QUERIES)
for q, data in current.items():
print(f'{q}: {len(data["citations"])} citations')Paso 3: Citas diferentes
Compare las citas actuales con las de referencia para encontrar adiciones y eliminaciones.
def extract_urls(citations: list) -> set:
urls = set()
for c in citations:
if isinstance(c, dict):
urls.add(c.get('url', c.get('link', '')))
elif isinstance(c, str):
urls.add(c)
return urls
def diff_citations(baseline_entry: dict, current_entry: dict) -> dict:
base_urls = extract_urls(baseline_entry.get('citations', []))
curr_urls = extract_urls(current_entry.get('citations', []))
added = curr_urls - base_urls
removed = base_urls - curr_urls
text_changed = baseline_entry.get('text_hash') != current_entry.get('text_hash')
return {
'added': list(added),
'removed': list(removed),
'text_changed': text_changed,
'has_changes': bool(added or removed or text_changed),
}
# Example:
base = {'citations': [{'url': 'https://a.com'}, {'url': 'https://b.com'}], 'text_hash': 'abc'}
curr = {'citations': [{'url': 'https://b.com'}, {'url': 'https://c.com'}], 'text_hash': 'def'}
diff = diff_citations(base, curr)
print(f'Added: {diff["added"]}, Removed: {diff["removed"]}, Text changed: {diff["text_changed"]}')Paso 4: Alerta sobre cambios
Genere alertas para cualquier cambio detectado e imprima un informe resumido.
def generate_alerts(baseline: dict, current: dict) -> list:
alerts = []
for query in current:
if query not in baseline:
continue
diff = diff_citations(baseline[query], current[query])
if diff['has_changes']:
alert = {
'query': query,
'date': current[query]['date'],
'added_citations': diff['added'],
'removed_citations': diff['removed'],
'text_changed': diff['text_changed'],
}
alerts.append(alert)
print(f'CHANGE DETECTED: {query}')
if diff['added']:
print(f' Added: {diff["added"]}')
if diff['removed']:
print(f' Removed: {diff["removed"]}')
if diff['text_changed']:
print(f' AI Overview text modified')
if not alerts:
print('No changes detected in AI Overviews')
return alerts
alerts = generate_alerts(baseline, current)Paso 5: Historial de cambios de registro
Mantenga un registro actualizado de todos los cambios detectados para realizar análisis de tendencias a lo largo del tiempo.
HISTORY_FILE = 'ai_overview_changes.jsonl'
def log_changes(alerts: list):
if not alerts:
return
with open(HISTORY_FILE, 'a') as f:
for alert in alerts:
f.write(json.dumps(alert) + '\n')
print(f'Logged {len(alerts)} changes to {HISTORY_FILE}')
def read_history() -> list:
entries = []
try:
with open(HISTORY_FILE) as f:
for line in f:
if line.strip():
entries.append(json.loads(line))
except FileNotFoundError:
pass
return entries
# Update baseline after processing
def update_baseline(current: dict):
with open(BASELINE_FILE, 'w') as f:
json.dump(current, f, indent=2)
print('Baseline updated')
log_changes(alerts)
history = read_history()
print(f'Total historical changes: {len(history)}')Ejemplo en Python
import requests, os, hashlib
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
def check_ai_overview(query):
data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'google', 'query': query}).json()
ai = data.get('ai_overview', {})
text = ai.get('text', '') if isinstance(ai, dict) else str(ai)
citations = ai.get('citations', []) if isinstance(ai, dict) else []
return {'hash': hashlib.md5(text.encode()).hexdigest(), 'citations': len(citations)}
print(check_ai_overview('best search api 2026'))Ejemplo en JavaScript
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
async function checkAiOverview(query) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: H, body: JSON.stringify({platform: 'google', query})
});
const ai = (await r.json()).ai_overview || {};
const text = ai.text || '';
return {length: text.length, citations: (ai.citations || []).length};
}
checkAiOverview('best search api 2026').then(console.log);Salida esperada
An automated daily system that monitors Google AI Overview changes, detects citation additions/removals, tracks text modifications, and maintains a change history log.