← Back to all products
$29
SERP Analyzer
SERP analysis tool for keyword rankings, snippet previews, and competitor position tracking.
PythonMarkdown
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 9 files
serp-analyzer/
├── LICENSE
├── README.md
├── examples/
│ └── sample_serp.html
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_how-to-save-a-serp-page.md
│ └── 03_cli-flags.md
├── index.html
└── src/
└── serp_analyzer.py
📖 Documentation Preview README excerpt
SERP Analyzer
Part of the SEO Toolkit by CodeVault
Analyze saved search engine results pages (SERPs) to extract featured snippets, People Also Ask questions, ranking signals, and content gap opportunities.
Features
- Extracts organic results with titles, URLs, and descriptions
- Detects 9 SERP features: featured snippets, PAA, knowledge panels, local packs, video carousels, image packs, top stories, shopping results, site links
- People Also Ask question extraction
- Title pattern analysis (length, common words, year usage)
- Content gap identification with actionable recommendations
- Keyword presence checking across result titles
- Text and JSON output formats
- Python stdlib only — zero dependencies
Quick Start
# Analyze a saved SERP page
python src/serp_analyzer.py --input examples/sample_serp.html
# With query context and keyword tracking
python src/serp_analyzer.py --input serp.html --query "python seo tools" --keywords "python,seo,tools"
# JSON output for programmatic use
python src/serp_analyzer.py --input serp.html --format json --output report.json
How to Save a SERP Page
1. Search for your target keyword on Google
2. Right-click → "Save As" → "Webpage, Complete" or "HTML Only"
3. Feed the saved HTML file to this analyzer
Output Includes
- SERP Features: Which special result types are present
- Top Organic Results: Position, title, URL, and title length
- People Also Ask: Extracted questions from PAA boxes
- Title Insights: Average length, common words, number/year usage
- Content Gaps: Actionable opportunities based on what's missing
- Keyword Presence: How often your keywords appear in result titles
CLI Flags
| Flag | Description |
|---|---|
--input, -i | Path to saved SERP HTML (required) |
--query, -q | The search query for context |
--keywords, -k | Comma-separated keywords to track |
--format, -f | Output format: text or json |
--output, -o | Output file (default: stdout) |
License
MIT — See LICENSE file.
📄 Code Sample .py preview
src/serp_analyzer.py
#!/usr/bin/env python3
"""
SERP Analyzer — SEO Toolkit by DataNest
Analyze search engine result page (SERP) HTML to extract featured snippets,
People Also Ask questions, ranking signals, and SERP feature opportunities.
Why this exists:
Understanding what Google shows for your target keywords is critical for
SEO strategy. This tool parses saved SERP HTML pages and extracts the
structured data that matters — featured snippets, PAA boxes, knowledge
panels, and organic results — so you can identify content gaps and
optimize your pages to win those positions.
Usage:
python serp_analyzer.py --input serp_page.html
python serp_analyzer.py --input serp_page.html --format json --output report.json
python serp_analyzer.py --input serp_page.html --keywords "python seo tools"
License: MIT
"""
from __future__ import annotations
import argparse
import html as html_module
import json
import logging
import re
import sys
from dataclasses import dataclass, field, asdict
from html.parser import HTMLParser
from pathlib import Path
from typing import Any
from collections import Counter
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
LOG = logging.getLogger("serp-analyzer")
# SERP feature indicators — CSS classes and data attributes commonly used
# by search engines to mark special result types
SERP_FEATURE_PATTERNS = {
"featured_snippet": [
r"featured-snippet", r"featured_snippet", r"kp-blk",
r"xpdopen", r"g-blk", r"ifM9O",
],
"people_also_ask": [
# ... 553 more lines ...