0.3.0 • Published 1 year ago

favicon-scraper-node v0.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

favicon-scraper-node

A fully-typed library for quickly getting a favicon from any domain. Supports getting the favicon's meta data like image dimensions and mime types Not browser compatible

links

If you're looking to get scraped favicons in the browser, check out the wrapper to an API I host wrapper

Installation

npm install --save favicon-scraper-node

Usage

import getFavicons from 'favicon-scraper-node';

const run = async () => {
  const favicons = await getFavicons('facebook.com')
  console.log(favicons)
  /*
    [
      {
        src: "https://static.xx.fbcdn.net/rsrc.php/yb/r/hLRJ1GG_y0J.ico",
        agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
      }
    ]
  */

  const probedFavicons = await getFavicons('facebook.com', {
    probe: true
  })
  console.log(probedFavicons)
  /*
    [
      {
        src: "https://static.xx.fbcdn.net/rsrc.php/yb/r/hLRJ1GG_y0J.ico",
        size: {
          width: 32,
          height: 32,
        },
        type: "ico",
        mime: "image/x-icon",
        agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
      }
    ]
  */
}

Options

const options: FaviconOptions = {
  agent: 'mobile_ios', // 'mobile_ios' | 'mobile_android' | 'desktop_chrome' | 'desktop_safari'
  manifest: false,  // Get the icons from the manifest.json
  scraper: 'fetch',
  probe: true
}
const favicons = await getFavicons('facebook.com', options)
0.3.0

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago