Skip to content

Instantly share code, notes, and snippets.

@quantumproxies
Created July 28, 2026 09:48
Show Gist options
  • Select an option

  • Save quantumproxies/9304e704462a3f20d009c289dc090bef to your computer and use it in GitHub Desktop.

Select an option

Save quantumproxies/9304e704462a3f20d009c289dc090bef to your computer and use it in GitHub Desktop.
SEO content research: extract the H2/H3 outlines of Google's top-5 for any keyword — https://quantumproxies.io/serp-api
# SEO content research: fetch Google's top-5 for a keyword, extract each
# page's heading outline (H2/H3), and print them side by side — what you
# must cover to compete for that query.
#
# SERP + extraction: https://quantumproxies.io/serp-api +
# https://quantumproxies.io/extract-api (one key for both:
# app.quantumproxies.io/api-keys)
#
# QP_API_KEY=qp_live_... python competitor-outline-analyzer.py "best vpn 2026"
import os, re, sys
import requests
BASE = "https://app.quantumproxies.io/api/v1/scraper"
HEADERS = {"Authorization": f"Bearer {os.environ['QP_API_KEY']}"}
query = sys.argv[1] if len(sys.argv) > 1 else "web scraping api"
serp = requests.post(f"{BASE}/serp", headers=HEADERS, timeout=90, json={
"query": query, "engine": "google", "country": "us", "num": 5,
}).json()
for hit in serp.get("organic", []):
print(f'\n#{hit["rank"]} {hit["title"]}\n {hit["link"]}')
try:
page = requests.post(f"{BASE}/extract", headers=HEADERS, timeout=120,
json={"url": hit["link"], "format": "markdown"}).json()
headings = re.findall(r"(?m)^(#{2,3})\s+(.+)$", page.get("content", ""))
for hashes, text in headings[:15]:
print(f' {" " * (len(hashes) - 2)}- {text.strip()}')
except Exception as e:
print(f" (could not extract: {e})")
# Read the outlines as a checklist: topics that appear in 3+ of the top-5
# are table stakes; topics NO ONE covers are your differentiation angle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment