Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Yes. Microlink’s Metadata API lets you request normalized page metadata and your own selector-based fields in one request. Add named rules to the data option, then receive values such as a product price, rating, stock state, or heading list alongside fields like title, image, and description. The custom rules and normalized metadata come from the same fetch and cache entry, avoiding a second page request.

What a single metadata-and-fields request returns

A metadata-only response is useful for link previews, but product and content workflows often need values that a page does not publish in standard Open Graph tags. A Microlink request can return both kinds of data:

  • Normalized metadata such as title, description, and image.
  • Named custom fields defined by CSS selectors in data.

Each rule is evaluated independently. If a selector matches nothing, or the extracted value cannot satisfy the requested type, that field resolves to null; other fields can still succeed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Basic JavaScript example

The documented SDK pattern looks like this:

const { title, image, price } = await microlink.metadata(
  'https://example.com/product',
  {
    data: {
      price: { selector: '.price', attr: 'text', type: 'number' }
    }
  }
)

console.log({ title, image, price })

.price is only an example. Inspect the target page and choose a selector that actually identifies its price element. A class name from one shop will not be universal.

How extraction rules map page markup to values

selector: first matching element

Use selector when you need one value, such as the first price, a product name, or a stock label.

data: {
  price: { selector: '[data-price]', attr: 'text', type: 'number' },
  sku: { selector: '.sku', attr: 'text', type: 'string' }
}

selectorAll: repeated values

Use selectorAll for collections, such as every heading or review score shown on a page.

data: {
  headings: {
    selectorAll: 'h2, h3',
    attr: 'text',
    type: 'string'
  }
}

The result is a collection rather than the first match. Keep the selector narrow enough that navigation headings and unrelated labels are not accidentally included.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

attr: choose the representation

The attr setting controls what is read from the matched element. Microlink documents representations including:

  • text for visible text.
  • html for the element’s HTML.
  • markdown for a Markdown representation.
  • json for JSON data where applicable.
  • val for form-control values.
  • An attribute name, such as href or content.

type: normalize and validate

Request a type when downstream code expects a predictable value. Documented types include string, number, boolean, date, url, and media types. Type validation is useful for preventing a currency symbol or explanatory text from silently becoming an invalid numeric value. Failed conversion produces null, so your application should handle that state.

Several product fields in one request

Put one named rule per field inside data. This example requests a title, price, rating, stock state, and gallery images together with normalized metadata:

const result = await microlink.metadata('https://shop.example/item', {
  data: {
    price: {
      selector: '[data-testid="price"]',
      attr: 'text',
      type: 'number'
    },
    rating: {
      selector: '[aria-label*="rating"]',
      attr: 'aria-label',
      type: 'string'
    },
    stock: {
      selector: '.availability',
      attr: 'text',
      type: 'string'
    },
    images: {
      selectorAll: '.product-gallery img',
      attr: 'src',
      type: 'url'
    }
  }
})

console.log(result)

Do not assume that a number is expressed in a particular currency, that a rating uses a particular scale, or that a stock label has a stable vocabulary. Store the source value and apply your own business rules where those semantics matter.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fallbacks and nested rules

Real sites often have markup variations between templates or experiments. The SDK documentation supports nested rule structures and ordered fallbacks: if one rule fails, a later rule can be attempted. Use this for known alternatives, for example a data attribute first and a visible price element second. Keep fallback selectors specific; broad fallbacks can capture promotional text or a crossed-out old price.

JavaScript-rendered values

A selector cannot read a value that is absent until client-side JavaScript runs. For dynamic prices, single-page applications, or content loaded after navigation, enable prerender: true and wait for the target with waitForSelector:

const result = await microlink.metadata('https://shop.example/item', {
  prerender: true,
  waitForSelector: '.price',
  data: {
    price: { selector: '.price', attr: 'text', type: 'number' }
  }
})

These options describe how Microlink prepares the page; they are not a guarantee that every site can be rendered or accessed. Test representative URLs, including products with different templates and unavailable items.

A practical implementation workflow

  1. Inspect default metadata first. If Open Graph or JSON-LD already contains the value, use that normalized field rather than maintaining a selector.
  2. Inspect the target DOM. Select an element tied to the value, not a fragile position such as “the third paragraph.”
  3. Choose the representation. Use text for visible labels, an attribute for links or data attributes, and selectorAll for lists.
  4. Declare a type. Request number, date, boolean, or url when your application needs normalization.
  5. Handle null explicitly. A missing or invalid field is an expected result, not necessarily a request failure.
  6. Add fallbacks only for known variants. Document which template each fallback covers.
  7. Enable prerendering for client-rendered content. Wait for a selector that proves the value is present.
  8. Test a representative set. Include redirects, localized pages, out-of-stock products, and pages whose content changes after load.

When selectors are the wrong tool

Rule-based extraction is designed for narrow fields. If you need an entire article or broad page content, Microlink’s Markdown workflow is the more appropriate documented approach. Selectors also depend on the target site’s markup, so a redesign can invalidate them even when the page still looks correct to a human.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Metadata extraction versus search indexing

Choose the workflow according to the output you need:

Need Better fit Important consideration
One response containing metadata and custom fields Microlink Metadata API Selectors, type conversion, null handling, and optional prerendering
Structured JSON attached while indexing Cloudflare Browser Run with AI Search Cloudflare documents up to five custom fields per instance, with text, number, boolean, or datetime types
Enriching a website search index from page-authored data Google Cloud Agent Search Uses inferred dates, meta tags, PageMaps, and Schema.org; page changes may require recrawling and schema changes trigger reindexing

The Cloudflare limit is specific to its AI Search instance, not a general limit on web extraction. Indexing products also introduce operational concerns—recrawls, reindexing, and freshness—that do not apply to a one-off API response in the same way.

Transport examples and error handling

For a production integration, log the requested URL, rule version, response status, and which fields were null. Avoid treating a valid response containing a null custom field as an HTTP failure. Retry transient transport errors with a bounded policy, but do not blindly retry a deterministic selector mismatch.

Common symptoms

  • Field is null: verify the selector, confirm the element exists in the fetched document, and check that the requested attr is present.
  • Number is null: inspect the text for currency symbols, ranges, or localized separators; request text first while adjusting the selector or normalization strategy.
  • List is empty: use selectorAll and confirm the repeated elements are present in the same DOM context.
  • Static HTML lacks the value: enable prerendering and wait for a selector that appears after JavaScript execution.
  • Wrong value from a page with multiple prices: narrow the selector to the purchase panel and add a template-specific fallback.
  • Results change after a redesign: update the selector rules and keep fixtures from representative pages so changes are detected early.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your immediate need is a clean visual capture rather than structured field values, ScreenshotNeo provides a one-call website screenshot API. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with the outcome exposed in response headers. Its MCP server lets Claude, Cursor, or another MCP client use take_screenshot, get_page_info, and capture_pdf.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the API documentation at https://screenshotneo.com/docs/ for all options. cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

FAQ

Frequently Asked Questions

Does one failed custom field fail the whole response?

No. Rules validate independently, so a missing or type-invalid field becomes null while other requested metadata and fields can still be returned.

Can I use this for a full article body?

Selectors are intended for narrow fields or lists. For broad article content, use Microlink’s documented Markdown workflow instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is prerendering guaranteed to work on every JavaScript site?

No. It is the documented configuration for client-rendered values, but access, rendering, and site behavior still vary; test the URLs that matter to your application.

The Bottom Line

Use Microlink’s data rules when one API response must combine normalized metadata with site-specific fields. Select deliberately, type values explicitly, treat null as normal, and add prerendering only when the target value appears after JavaScript runs.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.