Capture scrolling screenshots of webpages using Playwright with semantic section detection, HTML extraction, and automatic text-to-Markdown conversion for AI analysis
A modular Python tool for capturing intelligent, scrolling screenshots of webpages using Playwright's async API. Designed for AI integration with semantic section detection, HTML extraction, and automatic Markdown conversion.
brosh captures full-page screenshots by intelligently scrolling through webpages, detecting content boundaries, and organizing output by semantic sections. It provides both CLI and MCP server interfaces for AI tool integration.
```bash
pip install brosh
pip install -e .
playwright install
```
```bash
brosh shot "https://example.com"
brosh --app chrome --width 1920 --height 1080 shot "https://example.com" --format png --scale 100
brosh shot "https://example.com" --html
brosh --app chrome run
brosh shot "https://example.com" --scroll_step 80 --pause 2
```
```bash
brosh mcp
brosh-mcp
```
**Synchronous (for CLI scripts):**
```python
from brosh import capture_webpage
result = capture_webpage(
"https://example.com",
scale=50,
format="png"
)
```
**Asynchronous (for MCP/async apps):**
```python
from brosh import capture_webpage_async
async def main():
result = await capture_webpage_async(
"https://example.com",
html=True
)
# Returns same format with optional "html" field
```
```
src/brosh/
├── api.py # Public sync/async APIs
├── cli.py # Fire-based CLI interface
├── tool.py # Main BrowserScreenshotTool orchestrator
├── browser.py # BrowserManager (detection, launch, connection)
├── capture.py # CaptureManager (scrolling, section detection)
├── image.py # ImageProcessor (scaling, APNG creation)
├── models.py # Data models and enums
├── mcp.py # FastMCP server for AI integration
├── texthtml.py # DOMProcessor (HTML compression, Markdown)
└── __main__.py # CLI entry point
```
After making Python changes, run quality checks:
```bash
uzpy run .
fd -e py -x autoflake {}
fd -e py -x pyupgrade --py312-plus {}
fd -e py -x ruff check --output-format=github --fix --unsafe-fixes {}
fd -e py -x ruff format --respect-gitignore --target-version py312 {}
python -m pytest
```
1. **Browser Support**: Chrome/Edge recommended; Safari macOS-only; Firefox not supported
2. **Scroll Overlap**: Must be between 10-200% for proper section stitching
3. **Debug Ports**: Each browser type has fixed port assignment
4. **Async Context**: MCP server uses async API to avoid asyncio issues
Screenshots are organized by:
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/brosh-browser-screenshot-capture/raw