microlink logo

Microlink Recipe

Display embedded content, in a unified way

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

const universalEmbed = async (url, opts) => {
  const { data } = await mql(url, {
    meta: false,
    iframe: {
      maxWidth: 350,
    },
    ...opts,
  })

  return data.iframe
}

const result = await universalEmbed(
  'https://www.youtube.com/watch?v=9P6rdqiybaw'
)
console.log(result)