An r/ComplexWebScraping user asked about SERP APIs that return sponsored results. Google Ads data from SERP gives you competitor ad copy, position, and extensions without Google Ads API access. This tutorial shows how.
Prerequisites
- Scavio API key
- Python 3.8+
Walkthrough
Step 1: Fetch SERP with ads included
Standard Scavio Google search includes ads by default.
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
def get_serp_with_ads(keyword):
return requests.post('https://api.scavio.dev/api/v1/search',
headers=H,
json={'platform': 'google', 'query': keyword}).json()Step 2: Extract sponsored results
Parse the ads_results or sponsored_results field.
def extract_ads(serp):
ads = serp.get('ads_results', []) or serp.get('sponsored_results', [])
return [{'title': ad.get('title'), 'link': ad.get('link'),
'description': ad.get('description'), 'position': i+1}
for i, ad in enumerate(ads)]Step 3: Extract shopping ads
Google Shopping results appear separately.
def extract_shopping(serp):
return [{'title': s.get('title'), 'price': s.get('price'),
'source': s.get('source'), 'link': s.get('link')}
for s in serp.get('shopping_results', [])]Step 4: Track ad changes over time
Store daily snapshots for competitor ad monitoring.
import json, datetime
def save_snapshot(keyword, ads, shopping):
snapshot = {'date': str(datetime.date.today()), 'keyword': keyword,
'ads': ads, 'shopping': shopping}
with open(f'ad_snapshots/{keyword}.jsonl', 'a') as f:
f.write(json.dumps(snapshot) + '\n')Python Example
# Monitor 50 keywords for competitor ads:
# 50 queries/day × $0.005 = $0.25/day = $7.50/mo
# Returns: ad copy, position, sitelinks, shopping adsJavaScript Example
const serp = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
body: JSON.stringify({platform: 'google', query: keyword})
}).then(r => r.json());Expected Output
Daily snapshots of competitor Google Ads: ad copy, position, sitelinks, shopping ads. JSONL storage for trend analysis.