Direct Google Finance scraping is a maze of dynamic widgets and rotating selectors. The cleaner path uses SERP queries scoped to `site:google.com/finance` plus Scavio's extract endpoint. This tutorial walks the pattern that returns ticker pages as typed JSON without proxies or headless browsers.
Prerequisites
- Python 3.10+
- Scavio API key
Walkthrough
Step 1: Search a ticker
Scavio SERP scoped to Google Finance.
import requests, os
API_KEY = os.environ['SCAVIO_API_KEY']
def ticker_search(symbol):
r = requests.post('https://api.scavio.dev/api/v1/google',
headers={'x-api-key': API_KEY},
json={'query': f'site:google.com/finance {symbol}'})
return r.json().get('organic_results', [])Step 2: Extract the ticker page
Scavio extract returns markdown.
def fetch_ticker(url):
r = requests.post('https://api.scavio.dev/api/v1/extract',
headers={'x-api-key': API_KEY},
json={'url': url, 'format': 'markdown'})
return r.json().get('markdown', '')Step 3: Pull related news
Scavio news search adds context.
def ticker_news(symbol):
r = requests.post('https://api.scavio.dev/api/v1/google',
headers={'x-api-key': API_KEY},
json={'query': f'{symbol} stock news', 'search_type': 'news'})
return r.json().get('news_results', [])[:10]Step 4: Cross-check with SEC SERP
Find recent 10-Q filings via SERP.
def filings(symbol):
r = requests.post('https://api.scavio.dev/api/v1/google',
headers={'x-api-key': API_KEY},
json={'query': f'site:sec.gov 10-Q {symbol}'})
return r.json().get('organic_results', [])[:5]Step 5: Compose ticker brief
Markdown brief with price, news, filings.
def brief(symbol):
return {'page': fetch_ticker(ticker_search(symbol)[0]['link']), 'news': ticker_news(symbol), 'filings': filings(symbol)}Python Example
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
def finance_brief(symbol):
p = requests.post('https://api.scavio.dev/api/v1/google',
headers={'x-api-key': API_KEY},
json={'query': f'site:google.com/finance {symbol}'}).json()
n = requests.post('https://api.scavio.dev/api/v1/google',
headers={'x-api-key': API_KEY},
json={'query': f'{symbol} stock news', 'search_type': 'news'}).json()
return {'pages': p.get('organic_results',[])[:3], 'news': n.get('news_results',[])[:5]}
print(finance_brief('AAPL'))JavaScript Example
const API_KEY = process.env.SCAVIO_API_KEY;
export async function financeBrief(symbol) {
const headers = { 'x-api-key': API_KEY, 'Content-Type': 'application/json' };
const [p, n] = await Promise.all([
fetch('https://api.scavio.dev/api/v1/google', { method:'POST', headers, body: JSON.stringify({ query: `site:google.com/finance ${symbol}` }) }).then(r => r.json()),
fetch('https://api.scavio.dev/api/v1/google', { method:'POST', headers, body: JSON.stringify({ query: `${symbol} stock news`, search_type: 'news' }) }).then(r => r.json())
]);
return { p, n };
}Expected Output
Per-ticker brief with Google Finance page extract, recent news, and SEC filings — all via SERP queries, no direct scraping required.