metascraper-logo-favicon
TypeScript icon, indicating that this package has built-in type declarations

5.45.26 • Public • Published

metascraper

metascraper-logo-favicon: Metascraper logo favicon fallback.

See our website for more information.


Install

$ npm install metascraper-logo-favicon --save

API

metascraper-logo-favicon([options])

options

favicon

Type: boolean
Default: true

It tries to resolve favicon.ico of the url.

google

Type: boolean
Default: true

It enables logo resolution using Google API.

gotOpts

Type: object

Any option provided here will passed to got#options.

keyvOpts

Type: object

Any option provided here will passed to @keyvhq/memoize#options.

pickFn

Type: function

It will be used for picking the value to extract from a set of favicon detected on the markup.

const pickFn = (sizes, { pickDefault }) => {
  const appleTouchIcon = sizes.find((item) => item.rel.includes('apple'))
  return (appleTouchIcon || pickDefault(sizes)).url
}

const metascraper = require('metascraper')([
  require('metascraper-logo-favicon')({
    pickFn
  })
])

If you don't specific it, the favicon with the bigger size will be picked.

resolveFaviconUrl

Type: function

It will be used to determine if a favicon URL is valid.

rootFavicon

Type: boolean|regexp
Default: true

It tries to resolve favicon.ico of the url when the URL is a subdomain.

License

metascraper-logo-favicon © Microlink, released under the MIT License.
Authored and maintained by Microlink with help from contributors.

microlink.io · GitHub microlinkhq · X @microlinkhq

Package Sidebar

Install

npm i metascraper-logo-favicon

Weekly Downloads

12,181

Version

5.45.26

License

MIT

Unpacked Size

12.5 kB

Total Files

5

Last publish

Collaborators

  • kikobeats