Web Scraping
Turn any URL into structured JSON. Point CSS selectors at the fields you need — Microlink fetches the page, runs a browser when the content is client-rendered, and returns typed data.
Overview
Declare the shape. Get the data.
Web scraping on Microlink is built around a target url and a data schema. Each key in that schema becomes a field in the response; each rule tells Microlink how to pull that field from the page — a CSS selector, an attribute, a type, or a list. The API returns clean JSON: absolute URLs, typed images with size and dimensions, validated emails, or Markdown of the content you scoped.
- CSS selectors and attr rules define every field you want back
- Headless Chrome runs when the page needs JavaScript to render
- Types like url, image, and email normalize and validate server-side
Parameters
What an extraction call accepts.
urlstringThe page to fetch and extract from.dataobjectOutput schema: CSS-selector rules for each field you want back.selector / selectorAllstringScope a field or collection to part of the DOM.prerenderboolean | 'auto'Run headless Chrome for client-rendered pages.proxyboolean | stringAutomatic or BYO proxy when the target blocks the request.ttlstring | numberCache lifetime so repeated extractions on the same URL stay free.
Examples
Extraction shapes.
Shape any JSON with CSS-selector rules and typed fields.
Custom extract
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { image } = await microlink.extract(url, {
image: {
selector: 'meta[property="og:image"]',
attr: 'content',
type: 'image'
}
})