A single Google Maps listing gives you name, address, and rating. Adding Google review sentiment, Reddit mentions, and related Amazon products turns a thin lead into a qualified prospect. This pipeline enriches local business records from three search platforms through one Scavio API key at $0.005 per query, building a multi-dimensional profile for each business.
Prerequisites
- Python 3.8+
- requests library
- A Scavio API key from scavio.dev
- A list of businesses or locations to enrich
Walkthrough
Step 1: Search for local businesses on Google
Find local businesses by category and location.
import os, requests, json
API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}
def find_businesses(category, location, limit=10):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': f'{category} in {location}', 'country_code': 'us'}).json()
places = data.get('local_results', data.get('organic_results', []))[:limit]
businesses = []
for p in places:
businesses.append({
'name': p.get('title', p.get('name', '')),
'address': p.get('address', ''),
'rating': p.get('rating', 'N/A'),
'reviews': p.get('reviews', 0),
'link': p.get('link', '')
})
print(f'{category} in {location}: {len(businesses)} found')
return businesses
businesses = find_businesses('coffee shops', 'Austin TX')
for b in businesses[:3]: print(f' {b["name"]} - {b["rating"]} ({b["reviews"]} reviews)')Step 2: Enrich with Reddit sentiment
Search Reddit for mentions and extract sentiment signals.
def reddit_sentiment(business_name, location):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': f'{business_name} {location}', 'platform': 'reddit', 'country_code': 'us'}).json()
results = data.get('organic_results', [])[:5]
positive = negative = neutral = 0
mentions = []
for r in results:
snippet = r.get('snippet', '').lower()
if any(w in snippet for w in ['great', 'love', 'best', 'amazing', 'recommend']):
positive += 1
elif any(w in snippet for w in ['bad', 'terrible', 'avoid', 'worst', 'overpriced']):
negative += 1
else: neutral += 1
mentions.append(r.get('snippet', '')[:100])
return {'mentions': len(results), 'positive': positive, 'negative': negative,
'neutral': neutral, 'quotes': mentions[:3]}
for b in businesses[:3]:
sent = reddit_sentiment(b['name'], 'Austin')
b['reddit'] = sent
print(f' {b["name"]}: {sent["mentions"]} mentions (pos={sent["positive"]}, neg={sent["negative"]})')Step 3: Add related product data from Amazon
Find products the business might stock or compete with.
def related_products(business_name, category):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': f'{category} {business_name}', 'platform': 'amazon', 'country_code': 'us'}).json()
products = data.get('organic_results', data.get('shopping_results', []))[:3]
return [{'title': p.get('title', '')[:50], 'price': p.get('price', 'N/A'),
'rating': p.get('rating', 'N/A')} for p in products]
for b in businesses[:3]:
prods = related_products(b['name'], 'coffee')
b['amazon_products'] = prods
if prods: print(f' {b["name"]}: {len(prods)} related products (top: {prods[0]["title"][:40]})')Step 4: Generate enriched profiles
Combine all sources into a single enriched profile per business.
def enrich_batch(category, location, limit=5):
businesses = find_businesses(category, location, limit)
queries = 0
queries += 1 # initial search
for b in businesses:
b['reddit'] = reddit_sentiment(b['name'], location)
queries += 1
b['amazon_products'] = related_products(b['name'], category)
queries += 1
cost = queries * 0.005
print(f'\nEnriched {len(businesses)} businesses ({queries} queries, ${cost:.3f})')
for b in businesses:
r = b.get('reddit', {})
print(f'\n {b["name"]}')
print(f' Google: {b["rating"]} ({b["reviews"]} reviews)')
print(f' Reddit: {r.get("mentions", 0)} mentions, sentiment: +{r.get("positive", 0)}/-{r.get("negative", 0)}')
print(f' Amazon: {len(b.get("amazon_products", []))} related products')
with open('enriched.json', 'w') as f: json.dump(businesses, f, indent=2)
print(f'\nSaved to enriched.json')
return businesses
enrich_batch('coffee shops', 'Austin TX', 3)Python Example
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}
def enrich(biz, location):
g = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': f'{biz} {location}', 'country_code': 'us'}).json()
r = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': f'{biz} {location}', 'platform': 'reddit', 'country_code': 'us'}).json()
top = (g.get('organic_results') or [{}])[0]
mentions = len(r.get('organic_results', []))
print(f'{biz}: {top.get("rating", "N/A")} rating, {mentions} Reddit mentions. Cost: $0.010')
enrich('Houndstooth Coffee', 'Austin TX')JavaScript Example
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
async function enrich(biz, location) {
const [g, r] = await Promise.all([
fetch('https://api.scavio.dev/api/v1/search', { method: 'POST', headers: SH,
body: JSON.stringify({ query: `${biz} ${location}`, country_code: 'us' }) }).then(r => r.json()),
fetch('https://api.scavio.dev/api/v1/search', { method: 'POST', headers: SH,
body: JSON.stringify({ query: `${biz} ${location}`, platform: 'reddit', country_code: 'us' }) }).then(r => r.json()),
]);
const top = (g.organic_results || [{}])[0];
console.log(`${biz}: ${top.rating||'N/A'} rating, ${(r.organic_results||[]).length} Reddit mentions`);
}
enrich('Houndstooth Coffee', 'Austin TX').catch(console.error);Expected Output
coffee shops in Austin TX: 8 found
Houndstooth Coffee - 4.6 (1,234 reviews)
Epoch Coffee - 4.4 (892 reviews)
Fleet Coffee - 4.7 (567 reviews)
Enriched 3 businesses (7 queries, $0.035)
Houndstooth Coffee
Google: 4.6 (1,234 reviews)
Reddit: 4 mentions, sentiment: +3/-0
Amazon: 2 related products
Epoch Coffee
Google: 4.4 (892 reviews)
Reddit: 2 mentions, sentiment: +1/-1
Amazon: 3 related products
Saved to enriched.json