Help us shape the future of Go! Take the 2026 Go Developer Survey

loadfavicon

command module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: MIT Imports: 16 Imported by: 0

README

loadfavicon

Package loadfavicon look for and get favicons of given websites, written in go.

Value

  • multiple usecase: install and run standalone, embbeded within another go package, download icon files
  • extract any kind of favicon for a given websites

Features

  • look up all favicons referenced in the of a website, plus the favicon.ico file itself at the root of the website
  • returns only valid image files and urls. removes duplicates
  • sluggify names to valid filename to enable storage on disk (eg. to put them in cache for example)
  • get all favicons or only one according to choosen options

Examples

# https://go.dev has a single favicon file, an .ico, download it into ./myfavicons dir
# ./myfavicons will be created if does not exists
$ loadfavicon https://go.dev ./myfavicons
# https://www.docker.com/ has multiple icons, download all
$ loadfavicon https://www.docker.com/ ./myfavicons
# https://github.com has multiple icons, download the best one
$ loadfavicon https://github.com ./myfavicons --single

You ./myfavicons dir should looks like this:

$ ll 
- ./
- ../
- github-com+pinned-octocat.svg
- go-dev+favicon.ico
- www-docker-com+cropped-Docker-R-Logo-08-2018-Monochomatic-RGB_Moby-x1-180x180.png
- www-docker-com+cropped-Docker-R-Logo-08-2018-Monochomatic-RGB_Moby-x1-192x192.png
- www-docker-com+cropped-Docker-R-Logo-08-2018-Monochomatic-RGB_Moby-x1-32x32.png
- www-docker-com+favicon.ico

Requests or bugs?

https://github.com/lolorenzo777/loadfavicon/issues

Install

The program can be installed an used with a command line or the module can be used within another go program.

Go 1.16 introduces a new way to install Go programs directly with the go command:

go install github.com/lolorenzo777/loadfavicon

and to use the package into your own source code:

go get github.com/lolorenzo777/loadfavicon

Licence

MIT Licence

References

Documentation

Overview

Loadfavicon downloads favicons of a given website, written in go.

It can be installed an executed with the command line, or it can be embedded in your source code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL