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.1.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.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: seoextract-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 dc1a6a07e5b64dd4f8e863cbce104590a8e989f6be9ad4add65651be82d3685c
MD5 35d7b71112cca1b12a4b56e3b4f56089
BLAKE2b-256 dc84ccd83099b3f4e707f0419690739d8a2471439ba308d55a389dcb893c608b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: seoextract-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46437a3d20930f49172e1800cfca8f30200e0bd66b170f291e06d763756344ee
MD5 f54c577d20ce1177110d0e7a7f9e0c1b
BLAKE2b-256 3dd2d7e9047d5569bbb05594b3881ded37a6512e7baf4ed807762d666cfc0bab

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