Browser Markdown Scrape
URL to Markdown and CSS scrape via Browser Rendering quickAction
Convert a URL to Markdown and scrape CSS selectors using Cloudflare Browser Rendering quickAction (REST-style binding — not Puppeteer).
Features
GET /markdown?url=→ page Markdown viaquickAction("markdown")GET /scrape?url=&selector=→ structured elements viaquickAction("scrape")- HTTP/HTTPS URL validation only
API Reference
GET /markdown
url string (required)
Target page (http:// or https://).
Example Request
curl "https://your-worker.workers.dev/markdown?url=https://example.com"Success Response
{
"url": "https://example.com/",
"markdown": "# Example Domain\n\n..."
}Error Codes
400- Missing or non-http(s) url (INVALID_URL)502- quickAction failure (MARKDOWN_ERROR)
GET /scrape
url string (required)
Target page.
selector string (required)
CSS selector (sent as one scrape element).
Example Request
curl "https://your-worker.workers.dev/scrape?url=https://example.com&selector=h1"Success Response
{
"url": "https://example.com/",
"results": [
{
"selector": "h1",
"results": [{ "text": "Example Domain", "html": "Example Domain" }]
}
]
}Error Codes
400- Invalid url (INVALID_URL)400- Missing selector (MISSING_SELECTOR)502- quickAction failure (SCRAPE_ERROR)
Use Cases
- Normalize pages to Markdown for RAG / LLM pipelines
- Extract specific DOM fields without writing Puppeteer scripts
- Compare quickAction REST bindings vs Puppeteer-based experiments
Limitations
- Requires Browser Rendering (often
wrangler dev --remotelocally) - Single CSS selector per scrape request
- JS-heavy SPAs may need advanced goto options (not exposed in this demo)
Deployment
Confirm browser binding
wrangler.json declares "browser": { "binding": "BROWSER" }.
Test your deployment
curl "https://your-worker.workers.dev/markdown?url=https://example.com"Local Development
cd apps/experiments/browser-markdown-scrape
npm install
npm run dev -- --remotecurl "http://localhost:8787/markdown?url=https://example.com"Configuration
- Browser binding
BROWSER— usesquickAction("markdown" | "scrape", …)
Cloudflare Features Used
- Workers - Edge compute runtime
- Browser Rendering - Headless browser at the edge
- Markdown endpoint - URL → Markdown quick action
- Scrape endpoint - CSS selector scrape quick action