clawd/skills/cf-browser/SKILL.md

58 lines
2.2 KiB
Markdown

---
name: cf-browser
description: Fetch any webpage as markdown, JSON, or screenshot using Cloudflare Browser Rendering. Use when web_fetch fails on JS-heavy pages (SPAs, Zillow, Redfin, PCPAO, Cloudflare-protected sites). Handles full JS rendering on Cloudflare global network.
---
# Cloudflare Browser Rendering
Use this skill when you need to fetch a webpage that WebFetch can't handle — JS-heavy SPAs, sites behind Cloudflare protection, or pages that need full browser rendering to load content.
## When to use
- WebFetch returns empty/incomplete content
- The site is a SPA (React, Vue, etc.) that requires JS execution
- The site is behind Cloudflare bot protection
- You need a visual screenshot of a page
- You need to scrape specific elements via CSS selectors
## How to call
The script is at `/home/johan/clawd/skills/cf-browser/scripts/cf-fetch.sh`.
### Get page as markdown (most common)
```bash
/home/johan/clawd/skills/cf-browser/scripts/cf-fetch.sh markdown https://example.com
```
Returns clean markdown of the rendered page. This is the best option for reading page content.
### Take a screenshot
```bash
/home/johan/clawd/skills/cf-browser/scripts/cf-fetch.sh screenshot https://example.com [output.png]
```
Saves a PNG screenshot to the specified path (defaults to `/tmp/screenshot.png`). Use this when you need to see what a page looks like visually.
### Scrape structured data with CSS selectors
```bash
/home/johan/clawd/skills/cf-browser/scripts/cf-fetch.sh scrape https://example.com ".price, .title"
```
Returns JSON with the text content of elements matching the given CSS selectors. Use this when you need specific data points from a page.
## Interpreting output
- **markdown**: Raw markdown text printed to stdout. Pipe or capture as needed.
- **screenshot**: Prints the output file path on success. View the PNG with your screenshot/image tools.
- **scrape**: JSON array printed to stdout. Each element has `selector`, `results` with matched text content.
## Error handling
If the API returns an error, the script prints the error message to stderr and exits with code 1. Common issues:
- Invalid URL (must include https://)
- Cloudflare API rate limits
- Page timeout (very slow sites)