Skip to content

images

Sweeps every img element and returns each src as an absolute, deduped URL:
const images = await microlink.images('https://example.com')

Options

Override the default rule of selectorAll: 'img', attr: 'src', and type: 'url' with selectorAll, selector, attr, or type.

Examples

When a gallery lazy-loads, point attr at the attribute carrying the real source:
const images = await microlink.images('https://example.com/gallery', {
  selectorAll: 'img[data-src]',
  attr: 'data-src'
})
Or let the page render first so the real src is in place:
const images = await microlink.images('https://example.com/gallery', {
  prerender: true,
  scroll: 'footer'
})
Open Graph and Twitter Card images live in meta tags rather than img elements; use metadata for the page's representative image, or an extract rule with type: 'image' to get dimensions and size for each URL.