Skip to main content
Bun’s HTMLRewriter API extracts links from HTML. Chain CSS selectors to match the elements, text, and attributes you want to process, then pass .transform a Response, ArrayBuffer, or string.
extract-links.ts

Convert relative URLs to absolute

When scraping websites, you often want to convert relative URLs (like /docs) to absolute URLs:
extract-links.ts

See HTMLRewriter.