Skip to main content

`URLicon` helps you to discover an possible icon from a URL.

Project description

URLicon - v0.1.0

URLicon helps you to discover an possible icon from a URL.

We check for the metatag icons, favicons and, if we don't find, we check the first image in the URL html code. Finally, if nothing is found, we use the https://ui-avatars.com/api/ to bring you at least some avatar-like icon.

How to install and use

Install with uv or pip

uv add urlicon
# or
pip urlicon

Usage:

from urlicon import urlicon

url = "https://this-is.your-url.com/some-path"

icon_url = urlicon.get_url_icon(url)

print("icon:", icon_url)
# icon: "https://this-is.your-url.com/icon.jpeg"

Caching

URLicon use a simple "cache" method to avoid unecessary URL requests. It uses a temp dir for each execution. But you can define a your own directory and use the cache as much as you want setting STRING_CACHE_ROOT_DIR env var.

STRING_CACHE_ROOT_DIR = os.getenv("STRING_CACHE_ROOT_DIR", None)
cache = string_cache(cache_folder=STRING_CACHE_ROOT_DIR)

And you can clean the cache with:

urlicon.string_cache.clean()

See Also

License

This package is distributed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urlicon-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

urlicon-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file urlicon-0.1.0.tar.gz.

File metadata

  • Download URL: urlicon-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for urlicon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64cb9f5ad269d2b34061df8a0c3efdbb1a4ea15665e1cc7145b3d907ad45d9f5
MD5 51ebe3a2f1a197218dab2cd6d976c348
BLAKE2b-256 6b5a889797ea459b04aa20806970f85bc1710eff6e352149ba0bef9cf063551e

See more details on using hashes here.

File details

Details for the file urlicon-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: urlicon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for urlicon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25f578fa4e980f9e019fd83a439cfd50bb7f9e3c9fe3b3ab09a41da1978bb2ca
MD5 073fb75a3966c4eb4ab8579bf95165e5
BLAKE2b-256 8489191fbc422325e5965e603872657c5e7bfde257242bf06257d4e2e0660d39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page