Skip to content

pouriya-py/seo-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” SEO Analyzer

A professional Python tool for comprehensive SEO analysis of web pages

Python License uv Code Style

Features โ€ข Installation โ€ข Usage โ€ข Examples โ€ข Roadmap

Console Output

Console Output

HTML Report

HTML Report

๐Ÿ“– Overview

SEO Analyzer is a powerful command-line tool that performs comprehensive SEO audits on any website. Built with Python, it analyzes everything from basic meta tags to advanced technical SEO factors, providing actionable insights to improve your website's search engine ranking.

Whether you're an SEO specialist, web developer, or content creator, this tool helps you:

  • โœ… Identify SEO issues instantly
  • โœ… Get a detailed SEO score (0-100)
  • โœ… Generate professional HTML reports
  • โœ… Analyze multiple websites in batch
  • โœ… Track SEO metrics over time

โœจ Features

๐ŸŽฏ Core Analysis

Category What We Check
Basic SEO Title tags, Meta descriptions, Keyword optimization
Headings H1-H6 structure, hierarchy validation
Links Internal/External links, Nofollow detection, Broken links
Images Alt text coverage, Missing attributes
Content Word count, Paragraph analysis, Content quality

๐Ÿ”ง Technical SEO

  • โœ… HTTPS - Secure connection verification
  • โœ… Canonical URLs - Duplicate content prevention
  • โœ… Viewport - Mobile-friendliness check
  • โœ… Language - HTML lang attribute validation
  • โœ… Favicon - Brand presence check
  • โœ… Robots Meta - Indexability verification
  • โœ… Schema.org - Structured data detection

๐Ÿ“Š Performance & Security

  • โšก Load Time - Page speed measurement
  • โšก TTFB - Time to First Byte analysis
  • ๐Ÿ”’ HSTS - HTTP Strict Transport Security
  • ๐Ÿ”’ CSP - Content Security Policy
  • ๐Ÿ”’ X-Frame-Options - Clickjacking protection

๐ŸŒ Social Media Optimization

  • ๐Ÿ“˜ Open Graph - Facebook/LinkedIn optimization
  • ๐Ÿฆ Twitter Cards - Twitter sharing optimization

๐ŸŽจ Output Formats

  • ๐Ÿ“ Console - Beautiful formatted text with emojis
  • ๐Ÿ“Š JSON - Machine-readable for automation
  • ๐ŸŒ HTML - Professional visual reports

๐Ÿš€ Advanced Features

  • ๐Ÿ“ฆ Batch Analysis - Analyze multiple URLs at once
  • ๐Ÿ’พ Auto-Save - Automatic report saving with timestamps
  • ๐Ÿ“ˆ Summary Reports - Comparative analysis across sites
  • ๐ŸŽฏ SEO Score - Overall score with color-coded indicators

๐Ÿ“ฆ Installation

Method 1: Using uv (Recommended - Fastest)

# Install uv if you don't have it
# Linux/macOS
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Clone the repository
git clone https://github.com/pouriya-py/seo-analyzer.git
cd seo-analyzer

# Install dependencies
uv sync

Method 2: Using pip

# Clone the repository
git clone https://github.com/pouriya-py/seo-analyzer.git
cd seo-analyzer

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Linux/macOS
source venv/bin/activate
# Windows
venv\Scripts\activate

# Install dependencies
pip install -e .

๐Ÿš€ Usage

Basic Commands

# Analyze a single URL (console output)
uv run seo-analyze https://example.com

# Generate JSON output
uv run seo-analyze https://example.com --json

# Generate HTML report
uv run seo-analyze https://example.com --html

# Save HTML report with custom filename
uv run seo-analyze https://example.com --html -o my_report.html

Batch Analysis

# Analyze multiple URLs from command line
uv run seo-analyze https://example.com https://google.com https://github.com -o reports/

# Analyze URLs from a text file
uv run seo-analyze --file urls.txt -o reports/ --html

# Generate both JSON and HTML reports
uv run seo-analyze --file urls.txt -o reports/ --html

Creating a URL List

Create a file named urls.txt:

# My websites to analyze
https://example.com
https://google.com
https://github.com
https://en.wikipedia.org/wiki/Python_(programming_language)

Then run:

uv run seo-analyze --file urls.txt -o reports/ --html

๐Ÿ“Š Example Output

Console Report

======================================================================
๐Ÿ“Š SEO Report for: https://example.com
======================================================================

๐ŸŸก SEO SCORE: 63/100
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

๐Ÿ“Œ BASIC SEO
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Title: Example Domain
  Title Length: 14 chars โš ๏ธ
  Meta Description: โŒ Missing

๐Ÿ“Œ HEADINGS
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  H1: 1  |  H2: 0  |  H3: 0

๐Ÿ“Œ LINKS
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Total: 1  |  Internal: 0  |  External: 1  |  Nofollow: 0

๐Ÿ“Œ IMAGES
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Total: 0  |  With Alt: 0 โœ…  |  Without Alt: 0 โŒ

๐Ÿ“Œ CONTENT
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Word Count: 25
  Paragraphs: 1

๐Ÿ“Œ TECHNICAL
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  HTTPS: โœ… Yes
  Page Size: 0.55 KB โœ…
  Load Time: 0.45s  |  TTFB: 0.12s
  Viewport: โœ… Yes
  Canonical: โŒ No
  Language: en
  Favicon: โœ… Yes
  Indexable: โœ… Yes

๐Ÿ“Œ SECURITY
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  HSTS: โœ… Yes
  CSP: โŒ No
  X-Frame-Options: โœ… Yes

๐Ÿ“Œ SOCIAL MEDIA
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Open Graph: โŒ No
  Twitter Card: โŒ No

๐Ÿ“Œ STRUCTURED DATA
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  โŒ No Schema.org markup found

๐Ÿ“Œ SUMMARY
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  โŒ Issues (1):
     โ€ข Missing meta description
  โš ๏ธ  Warnings (4):
     โ€ข Title is too short (14 chars, recommended: 30-60)
     โ€ข Missing Open Graph tags (for social media)
     โ€ข Missing Twitter Card tags
     โ€ข No Schema.org markup found
  โœ… Passed (5):
     โ€ข H1 tag structure is correct
     โ€ข Viewport meta tag is set (mobile-friendly)
     โ€ข Language attribute is set (en)
     โ€ข Favicon is set
     โ€ข Page is indexable (no robots meta restrictions)

======================================================================

HTML Report

The HTML report provides a beautiful, responsive visualization with:

  • ๐ŸŽจ Modern gradient design
  • ๐Ÿ“Š Visual score indicator with color coding
  • ๐Ÿ“ฑ Mobile-friendly layout
  • ๐Ÿ“‹ Detailed breakdown of all metrics
  • ๐Ÿ’ก Actionable recommendations

๐Ÿงช Testing

Test the tool with these sample URLs:

# Simple test site
uv run seo-analyze https://example.com

# E-commerce sandbox
uv run seo-analyze https://books.toscrape.com/

# Large website
uv run seo-analyze https://en.wikipedia.org/wiki/Python_(programming_language)

๐Ÿ›  Development

Setup Development Environment

# Install with dev dependencies
uv sync --dev

# Format code with Black
uv run black src/

# Check code with Ruff
uv run ruff check src/

# Run tests (when available)
uv run pytest

Project Structure

seo-analyzer/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ seo_analyzer/
โ”‚       โ”œโ”€โ”€ __init__.py              # Package initialization
โ”‚       โ”œโ”€โ”€ analyzer.py              # Core SEO analysis logic
โ”‚       โ”œโ”€โ”€ cli.py                   # Command-line interface
โ”‚       โ””โ”€โ”€ report_generator.py      # HTML report generation
โ”œโ”€โ”€ tests/                           # Test suite (future)
โ”œโ”€โ”€ reports/                         # Generated reports (gitignored)
โ”œโ”€โ”€ pyproject.toml                   # Project configuration
โ”œโ”€โ”€ README.md                        # This file
โ”œโ”€โ”€ LICENSE                          # MIT License
โ””โ”€โ”€ .gitignore                       # Git ignore rules

๐Ÿ“ˆ SEO Score Breakdown

The SEO score (0-100) is calculated based on:

Factor Points Description
Title Tag 15 Presence and optimal length (30-60 chars)
Meta Description 15 Presence and optimal length (120-160 chars)
H1 Tag 10 Single H1 tag present
HTTPS 10 Secure connection
Viewport 10 Mobile-friendly
Images Alt 10 All images have alt text
Canonical 5 Canonical URL set
Language 5 HTML lang attribute
Open Graph 5 Social media tags
Schema.org 5 Structured data
Indexable 10 Not blocked by robots

Score Interpretation:

  • ๐ŸŸข 80-100: Excellent - Well optimized
  • ๐ŸŸก 60-79: Good - Minor improvements needed
  • ๐ŸŸ  40-59: Needs Work - Several issues found
  • ๐Ÿ”ด 0-39: Poor - Critical SEO problems

๐Ÿ”ฎ Roadmap

Phase 1: Core Features โœ…

  • Basic SEO analysis
  • Technical SEO checks
  • HTML report generation
  • Batch analysis
  • JSON output

Phase 2: Advanced Analysis (Coming Soon)

  • JavaScript rendering with Playwright
  • Core Web Vitals integration (LCP, INP, CLS)
  • Sitemap.xml analysis
  • Robots.txt validation
  • Internal linking structure analysis

Phase 3: Intelligence (Future)

  • Content quality analysis with NLP
  • Keyword density analysis
  • Readability scoring
  • Competitor comparison
  • Google Search Console API integration

Phase 4: Enterprise (Future)

  • Web dashboard with FastAPI
  • Automated monitoring & alerts
  • Historical trend analysis
  • Multi-user support
  • API for SaaS integration

๐Ÿค Contributing

Contributions are what make the open source community amazing! Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

Distributed under the MIT License. See LICENSE for more information.


๐Ÿ‘ค Author

Pouriya Bavinejad


๐Ÿ™ Acknowledgments

  • BeautifulSoup - HTML parsing library
  • Requests - HTTP library for Python
  • uv - Fast Python package installer
  • Black - Python code formatter
  • Ruff - Fast Python linter

โญ Show your support

Give a โญ๏ธ if this project helped you!


Built with โค๏ธ by Pouriya Bavinejad

Made for the SEO community

About

๐Ÿ” Professional SEO analysis tool built with Python. Analyze title tags, meta descriptions, headings, links, images, technical SEO, performance metrics, security headers, and more. Get SEO scores, HTML reports, and batch analysis capabilities. Perfect for SEO specialists and web developers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages