Attention & SEO
Attention-layer intelligence: Google SERP scraping (organic results, AI Overview, People Also Ask), Google Trends interest, Meta Ad Library active-ad search, plus Pry's SEO analysis endpoints for on-page optimization.
What it scrapes
| Source | Data |
|---|---|
| Google SERP | Organic results, AI Overview text, People Also Ask questions (num 1–100) |
| Google Trends | Interest over time + related queries for a keyword (timeframe e.g. today 12-m) |
| Meta Ad Library | Active ads by page name + country (limit 1–200, default 20) |
| Any URL (SEO) | Title, meta description, keywords, headings, canonical, OG/Twitter tags, word count, link counts, schema, hreflang |
Endpoints
Router: routers/attention.py (tag Attention) + routers/seo.py (tag SEO)
| Method | Path | Summary |
|---|---|---|
| GET | /v1/attention/serp | Google SERP: organic + AI Overview + PAA |
| GET | /v1/attention/trends | Google Trends interest over time + related |
| GET | /v1/attention/ads | Meta Ad Library active-ad search |
| POST | /v1/seo/analyze | Full SEO element analysis of a URL |
| POST | /v1/seo/track | Track SEO changes since the last scan |
| POST | /v1/seo/keywords | Keyword presence / density analysis in a URL |
| POST | /v1/seo | Legacy SEO analysis endpoint (extraction router) |
GET /v1/attention/serp
Query params: q (required), num (1–100, default 10).
curl -X GET "http://localhost:8005/v1/attention/serp?q=best%20web%20scraping%20api&num=10" \
-H "Authorization: Bearer <key>"
Response (200):
{
"success": true,
"data": {
"query": "best web scraping api",
"organic": [
{
"position": 1,
"title": "Best Web Scraping APIs in 2026",
"url": "https://example.com/best-scraping-apis",
"snippet": "Compare the top web scraping APIs..."
}
],
"ai_overview": "The best web scraping APIs balance bypass reliability, cost...",
"people_also_ask": [
"Is web scraping legal?",
"What is the cheapest web scraping API?"
]
}
}
GET /v1/attention/trends
Query params: keyword (required), timeframe (default today 12-m).
curl -X GET "http://localhost:8005/v1/attention/trends?keyword=web%20scraping&timeframe=today%203-m" \
-H "Authorization: Bearer <key>"
Response (200):
{
"success": true,
"data": {
"keyword": "web scraping",
"timeframe": "today 3-m",
"interest": [
{"date": "2026-05-16", "value": 78},
{"date": "2026-06-16", "value": 85},
{"date": "2026-07-16", "value": 91}
],
"related": [
{"query": "python web scraping", "value": 100},
{"query": "scrape any website", "value": 62}
]
}
}
GET /v1/attention/ads
Query params: page_name (required), country (ISO 2-letter, default
US), limit (1–200, default 20).
curl -X GET "http://localhost:8005/v1/attention/ads?page_name=Example%20Brand&country=US&limit=10" \
-H "Authorization: Bearer <key>"
Response (200):
{
"success": true,
"data": [
{
"page_name": "Example Brand",
"ad_text": "Save 20% on your first order",
"start_date": "2026-07-01",
"platforms": ["facebook", "instagram"],
"url": "https://www.facebook.com/ads/library/?id=123456789"
}
]
}
POST /v1/seo/analyze
curl -X POST http://localhost:8005/v1/seo/analyze \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{"url": "https://example.com"}'
Response (200): title, meta_description, keywords, headings (H1/H2),
canonical, og_tags, twitter_card, word_count, internal_links,
external_links, schema_types, hreflang.
POST /v1/seo/track
Same request shape as /v1/seo/analyze — compares the current scan to the
previous snapshot and reports what changed (title, description, headings,
etc.).
POST /v1/seo/keywords
curl -X POST http://localhost:8005/v1/seo/keywords \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{"url": "https://example.com", "keywords": ["web scraping", "api"]}'
Response (200): per keyword — presence in title/H1/meta description, frequency in body, and keyword density percentage.
MCP tools
No dedicated MCP tool for attention/SEO endpoints yet — call REST directly,
or use pry_scrape + pry_enrich from agents for page-level intel.
Who uses this
- SEO agencies — rank tracking (
serp), content gap analysis (trends), and on-page audits (seo/analyze). - Competitive intelligence — competitor ad creatives from Meta Ad Library; AI Overview presence for your keywords.
- Content marketers — keyword interest trends to time content.
- Monitoring pipelines —
seo/trackin a nightly job to catch on-page regressions.
Next steps
- Monitoring — watch SERP/SEO pages for changes
- Extraction API — pull structured data from any page
- Intelligence — competitor snapshots and reports