microlink logo

Microlink Recipe

Detect all the images of the target URL

getImages.js
const mql = require('@microlink/mql')

const getImages = async (url, opts) => {
  const { data } = await mql(url, {
    meta: false,
    data: {
      images: {
        selectorAll: 'img',
        attr: 'src',
        type: 'image',
      },
    },
    ...opts,
  })

  return data.images
}

const result = await getImages('https://microlink.io')

mql.render(result)