Data extraction: turn any page into structured JSON
Describe the fields you want with CSS selectors and the data parameter does the rest — no headless browser to run, no HTML to parse. Works on the free tier; Pro adds automatic proxy resolution when targets fight back.
The data object you send is the shape of the JSON you get back. Point a selector at an element, pick what to read with attr — text, an attribute, HTML, even markdown — and validate the result with type: url, number, date, image, and more.
Pages change and selectors break — so a rule can also be an array of fallbacks, tried in priority order until one succeeds. When CSS alone is not enough, evaluate runs a JavaScript function against the page to compute the value.
Microlink runs the headless browser, waits for the content, applies your rules, and returns clean JSON — the same request can also capture the screenshot, render the PDF, or read the metadata of the page.
From a single field to a full collection
Every extraction rule is built from the same five properties — selector, selectorAll, attr, type, and evaluate. Combine them to match the shape of the data you are after.
href or src, inner HTML, or a markdown rendition. Add type to validate and normalize the value before it reaches your code.Your first extraction, two rules
Each key inside data is a field in the response. Here headline reads the text and link reads the href, validated as a URL — no parsing on your side.
import mql from '@microlink/mql'
const { data } = await mql('https://news.ycombinator.com', {
data: {
headline: { selector: '.titleline > a', attr: 'text' },
link: { selector: '.titleline > a', attr: 'href', type: 'url' }
}
})
console.log(data.headline, data.link)Every match, as structured objects
selectorAll turns the rule into an array; nested attr rules run against each match. Add meta: false to skip metadata and get just your fields back.
const { data } = await mql('https://news.ycombinator.com', {
data: {
stories: {
selectorAll: '.athing',
attr: {
title: { selector: '.titleline > a', attr: 'text' },
href: { selector: '.titleline > a', attr: 'href', type: 'url' }
}
}
},
meta: false
})Pro adds the unblocking layer
Extraction rules are half the job — the other half is getting the page to render at all. Every Pro plan bundles the pieces that keep scraping working in production: automatic proxy resolution against antibots, custom headers for login walls, and configurable cache TTL so repeated extractions cost nothing.
cookie to the target — the credential rides inside HTTPS and never touches the URL.Selectors in, JSON out.
Prototype on the free tier — 25 requests a day, no API key. When you go to production, Pro plans start at 14,000 requests per month and bundle proxy resolution, custom headers, and configurable TTL.
Do I need to run a headless browser?
Is data extraction available on the free plan?
What happens when a selector doesn't match?
Can I scrape sites behind Cloudflare or DataDome?
-proxy. See how the proxy works.