This site is not affiliated with or endorsed by Cloudflare, Inc. It simply showcases experiments built using Cloudflare services.
Cloudflare Experiments

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 via quickAction("markdown")
  • GET /scrape?url=&selector= → structured elements via quickAction("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 --remote locally)
  • Single CSS selector per scrape request
  • JS-heavy SPAs may need advanced goto options (not exposed in this demo)

Deployment

Click the deploy button

Deploy to Cloudflare Workers

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 -- --remote
curl "http://localhost:8787/markdown?url=https://example.com"

Configuration

  • Browser binding BROWSER — uses quickAction("markdown" | "scrape", …)

Cloudflare Features Used

On this page