@microlink/recipes
Version:
Build something with just a few of lines
33 lines (28 loc) • 596 B
JavaScript
const mql = require('@microlink/mql')
module.exports = async (url, opts) => {
const { data } = await mql(url, {
meta: false,
data: {
favicon: [
{
selector: 'link[href*="favicon.ico"]',
attr: 'href',
type: 'image'
},
{
selector: 'link[type="image/x-icon"]',
attr: 'href',
type: 'image'
}
]
},
...opts
})
return data.favicon
}
module.exports.meta = {
name: 'Favicon',
description: 'Get the favicon for any web',
examples: ['https://microlink.io']
}