Skip to main content

URL to screenshot with metadata. Python MCP server included. Claude Vision optimized.

Project description

Snapgrab

URL to screenshot with metadata. Claude Vision optimized.

from snapgrab import capture

result = await capture("https://example.com")
print(result.path)           # /tmp/snapgrab/example_com_desktop_20260317_120000.png
print(result.metadata.title) # "Example Domain"
print(result.vision_tokens)  # ~2764

Features

  • Screenshot capture — PNG, JPEG, PDF with full-page support
  • Page metadata — title, description, Open Graph tags, favicon, HTTP status
  • Claude Vision optimized — auto-resize to 1568px, token cost estimation
  • Viewport presets — desktop (1920x1080), tablet (768x1024), mobile (375x812)
  • MCP server included — 3 tools for Claude Code / MCP clients
  • Element capture — screenshot specific CSS selectors
  • Dark mode — force light/dark color scheme

Install

pip install snapgrab

First run will prompt to install Playwright browsers:

playwright install chromium

Usage

Python API

import asyncio
from snapgrab import capture

async def main():
    # Basic screenshot
    result = await capture("https://example.com")

    # Mobile viewport, full page
    result = await capture("https://example.com", viewport="mobile", full_page=True)

    # Dark mode, JPEG format
    result = await capture("https://example.com", dark_mode=True, format="jpeg")

    # Specific element
    result = await capture("https://example.com", selector="#main-content")

    # Custom viewport
    result = await capture("https://example.com", viewport=(1440, 900))

asyncio.run(main())

CLI

snapgrab https://example.com                          # basic PNG
snapgrab https://example.com -v mobile -f             # mobile, full page
snapgrab https://example.com --format jpeg -q 90      # JPEG quality 90
snapgrab https://example.com -s "#hero" --dark-mode   # element + dark mode
snapgrab https://example.com -j                       # JSON output
snapgrab meta https://example.com                     # metadata only

MCP Server

pip install "snapgrab[mcp]"
snapgrab-mcp  # starts stdio MCP server

Tools:

  • capture_screenshot — capture URL with metadata and vision token estimate
  • capture_comparison — compare desktop vs mobile (or any viewports)
  • extract_page_metadata — metadata only, no screenshot

CaptureResult

result.path            # saved file path
result.format          # "png", "jpeg", "pdf"
result.width           # viewport width
result.height          # page height (full_page) or viewport height
result.file_size       # bytes
result.vision_tokens   # estimated Claude Vision token cost
result.vision_path     # path to Vision-optimized image (≤1568px)
result.processing_time_ms
result.metadata.title
result.metadata.description
result.metadata.og_title
result.metadata.og_image
result.metadata.favicon_url
result.metadata.status_code
result.metadata.url    # final URL after redirects

License

MIT

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

snapgrab-0.1.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

snapgrab-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file snapgrab-0.1.0.tar.gz.

File metadata

  • Download URL: snapgrab-0.1.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snapgrab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db55f37c70830abc7d2a44ecdbda06a16304a17a6459d82cef16b43b28ac7fa0
MD5 c2bbd90c72569f8b222b1c5f7f3e501e
BLAKE2b-256 119465dbdfade5a48946f6eeed97ce2bc06ed9720093a7ad91b4a01bf2a025aa

See more details on using hashes here.

File details

Details for the file snapgrab-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: snapgrab-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snapgrab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d668b0d15b26a43967a266e1766883e8b886f8f2187c91e887621ffd7fb5558
MD5 e268b137822a051d07ba691a8e24b85a
BLAKE2b-256 4669fb996af9ebecb6bc5f2751c652583f6a7a7fda1391bc17365c82f93ff475

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