Fetch icon links from sites like a breeze. It supports "icon", "shortcut icon", "apple-touch-icon", "apple-touch-icon-precomposed", "fluid-icon", and "mask-icon".
# get icons from one site
iex> Iconic.get("https://elixir-lang.org")
[%Icon.Parse.Icon{href: "https://elixir-lang.org/favicon.ico",
rel: "shortcut icon", sizes: nil, type: "image/x-icon"}]
# get icons from multiple sites concurrently
iex> Enum.to_list(Iconic.mget(
["https://elixir-lang.org", "news.ycombinator.com", "https://www.reddit.com"]))
[ok: [%Icon.Parse.Icon{href: "https://elixir-lang.org/favicon.ico",
rel: "shortcut icon", sizes: nil, type: "image/x-icon"}],
ok: [%Icon.Parse.Icon{href: "http://news.ycombinator.comfavicon.ico",
rel: "shortcut icon", sizes: nil, type: nil}],
ok: [%Icon.Parse.Icon{href: "http://www.redditstatic.com/icon.png",
rel: "icon", sizes: "256x256", type: "image/png"},
%Icon.Parse.Icon{href: "http://www.redditstatic.com/favicon.ico",
rel: "shortcut icon", sizes: nil, type: "image/x-icon"},
%Icon.Parse.Icon{href: "http://www.redditstatic.com/icon-touch.png",
rel: "apple-touch-icon-precomposed", sizes: nil, type: nil}]]
# with control options (timeout and max concurrency)
iex> Enum.to_list(Iconic.mget(
["https://elixir-lang.org", "news.ycombinator.com", "https://www.reddit.com"],
[max_concurrency: 16, timeout: 30000]))
The package can be installed by adding iconic
to your list of dependencies in mix.exs
:
def deps do
[
{:iconic, "~> 0.1.1"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/iconic.
Apache 2.0