Skip to main content

A lightweight Python SEO audit engine that returns Pydantic structured output.

Project description

SEOExtract

A lightweight Python SEO audit engine with built-in Google Safe Browsing support.

Returns validated Pydantic structured output that can be directly consumed by AI agents, dashboards, APIs, report generators, and automation pipelines.


Features

  • Website crawler
  • Google Safe Browsing validation
  • Technical SEO auditing
  • Pydantic structured output
  • Page-level SEO metrics
  • Site-level SEO scoring
  • Severity-based issue detection
  • Duplicate title detection
  • Duplicate meta description detection
  • Canonical tag detection
  • Viewport detection
  • Schema.org detection
  • Image alt-text validation
  • Internal linking analysis
  • Thin content detection

Installation

pip install seoextract

or install from source

pip install -e .

Requirements

  • Python 3.10+
  • Google Safe Browsing API Key

Google Safe Browsing Setup

SEOExtract checks every website against Google's Safe Browsing service before crawling.

If Google reports the website as unsafe, crawling is stopped automatically.

If no Google Safe Browsing API key is provided, safe_browsing.is_safe will be None.

Option 1 (Recommended)

Create a .env file.

.env

Add your API key.

GOOGLE_SAFE_BROWSING_API_KEY=YOUR_API_KEY

SEOExtract automatically loads the API key.

No additional code is required.


Option 2

Pass the API key manually.

from seoextract import SEOExtract

result = SEOExtract.audit(
    "https://example.com",
    safe_browsing_api_key="YOUR_API_KEY"
)

When an API key is supplied manually, the .env file is not used.


Quick Start

from seoextract import SEOExtract

result = SEOExtract.audit(
    "https://example.com"
)

print(result.model_dump_json(indent=2))

Returned Object

SEOExtract returns a validated Pydantic model.

AuditResult
│
├── url
├── audit_date
├── pages_crawled
├── site_score
├── grade
├── total_issues
├── critical_count
├── warning_count
├── info_count
├── pages
├── issues
└── safe_browsing

Example

from seoextract import SEOExtract

result = SEOExtract.audit("https://example.com")

print(result.site_score)
print(result.grade)
print(result.safe_browsing)

for issue in result.issues:
    print(issue.issue_type)

Safe Browsing Result

{
    "is_safe": True,
    "threats": [],
    "error": None
}

If Google reports a threat:

{
    "is_safe": False,
    "threats": [
        "MALWARE"
    ],
    "error": None
}

SEOExtract immediately stops crawling unsafe websites.


Current SEO Checks

Page Quality

  • Title validation
  • Meta description validation
  • H1 validation
  • Thin content detection

Technical SEO

  • Canonical tag
  • Viewport meta tag
  • Schema.org JSON-LD
  • HTTP status validation

Images

  • Missing ALT attributes

Links

  • Internal link analysis

Site-wide Checks

  • Duplicate titles
  • Duplicate meta descriptions

Security

  • Google Safe Browsing validation

Example Output

AuditResult(
    site_score=91.0,
    grade="A",
    total_issues=4,
    pages_crawled=15
)

Project Structure

seoextract/
│
├── crawler.py
├── parser.py
├── rules.py
├── scorer.py
├── safe_browsing.py
├── models.py
└── __init__.py

Designed For

SEOExtract is designed to be used inside:

  • AI SEO Agents
  • LangGraph workflows
  • FastAPI applications
  • Streamlit dashboards
  • Report generators
  • CI/CD quality checks
  • Data pipelines
  • SEO automation tools

Dependencies

  • beautifulsoup4
  • lxml
  • requests
  • pydantic
  • python-dotenv

License

MIT License


Author

Britto K

GitHub:

https://github.com/Britto1221# seoextract

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seoextract-0.1.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seoextract-0.1.2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file seoextract-0.1.2.tar.gz.

File metadata

  • Download URL: seoextract-0.1.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for seoextract-0.1.2.tar.gz
Algorithm Hash digest
SHA256 51f6dc66cb788462406f404abce1e63d7d08373cafa170ebc100defc540ebacd
MD5 8d27e56be569b9eca85fadd7f414c322
BLAKE2b-256 b60c1729e4396b2b9bfef93df6c5382ff956a35afac67ea7680af45149e139ac

See more details on using hashes here.

File details

Details for the file seoextract-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: seoextract-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for seoextract-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0219c1c09aae0a9f95b20235919aa2f092181237a0263cc0279d4aa63d5c49bc
MD5 ec07a556e033e38552c00e02223c5535
BLAKE2b-256 c921bc7ece71181cbb08771d1caaa7046529af8b7a3e0be3b64c7383f94b1640

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page