Skip to content

Repository files navigation

rendermod

Page rendering and state capture for AI analysis. rendermod uses Playwright to load a URL, collect page state (HTML, screenshot, text, links, metadata, console output, errors, accessibility tree), and write structured outputs for downstream tools.

Features

  • Device presets: mobile, tablet, desktop
  • Config-driven renders with per-page overrides
  • Form-based login automation for password-protected sites
  • localStorage injection before page load
  • Structured JSON summary to stdout
  • Embedded, colorized help (no external docs needed)

Requirements

  • Python 3.8+
  • Playwright
  • PyYAML (for render.yaml support)

Install Playwright and Chromium:

pip install playwright
playwright install chromium

Install PyYAML:

pip install pyyaml

Quick Start

Initialize configuration:

python -m rendermod --init

Render a page:

python -m rendermod submit
python -m rendermod submit mobile
python -m rendermod /api/status
python -m rendermod stats desktop -debug=n

Configuration

rendermod reads render.yaml from the current directory. If render.yaml is missing but render.json exists, it will be auto-converted on startup. The schema includes:

  • base_url: Base URL for all requests
  • auth: Optional form-based login (username, password, loginUrl, selectors)
  • defaults: device, output directory, extraction types
  • args: query-string args and defaults
  • storage: localStorage values and defaults (optional)
  • pages: per-page overrides (optional)

Example:

{
  "base_url": "https://example.com",
  "auth": {
    "username": "user@example.com",
    "password": "secretpassword",
    "loginUrl": "https://example.com/login",
    "selectors": {
      "username": "#email",
      "password": "#password",
      "submit": "button[type=submit]"
    }
  },
  "defaults": {
    "device": "mobile",
    "out_dir": "render_out",
    "extract": ["metadata", "text", "links"]
  },
  "args": {
    "values": {"debug": "y"},
    "default": ["debug"]
  },
  "storage": {
    "values": {"session": {"user": "test"}},
    "default": ["session"]
  },
  "pages": {
    "dashboard": {
      "auth": {
        "username": "admin@example.com"
      }
    },
    "submit": {
      "args": ["debug"]
    }
  }
}

Output

Each render produces three files in the configured output directory:

  • <page>.json: full captured state
  • <page>.html: raw HTML
  • <page>.png: full-page screenshot

Stdout prints a JSON summary with status, paths, stats, and metadata.

Commands

Quick help:

python -m rendermod
python -m rendermod help

Detailed help:

python -m rendermod --help
python -m rendermod --help config
python -m rendermod --help output
python -m rendermod --help args
python -m rendermod --help auth
python -m rendermod --help storage
python -m rendermod --help devices
python -m rendermod --help examples

Development

No build step required. Run directly from the repo:

python -m rendermod

Notes

  • Device presets: mobile, tablet, desktop.
  • Paths starting with / are used as-is; other paths are appended to base_url.
  • If render.yaml is missing, the CLI prompts to run --init.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages