Skip to main content

Infer an image for a given URL

What this does:

Given the URL of a website (e.g. "https://www.mozilla.org"), it attempts to find the most appropriate image that represents this site, and returns the URL of that image.

How it works:

The HTML of the page is parsed (BeautifulSoup) and meta/link tags are extracted which may contain clues as to which image to use. Failing this, the favicon is tried, or else it searches for the first img tag following the first h1 on the page.

The default search order is:

DEFAULT_CHECK_ORDER = [
    SCHEMA_IMAGE,
    OG_IMAGE,
    TWITTER_IMAGE,
    MS_WIDE_310,
    MS_SQUARE_310,
    ICON,
    APPLE_TOUCH_ICON,
    MS_SQUARE_150,
    MS_SQUARE_70,
    FAV_ICON,
    FIRST_IMAGE,
]

Which corresponds to:

  • meta tag with itemprop="image" or property="image"
  • meta tag with property="og:image:secure_url" or property="og:image"
  • meta tag with name="twitter:image"
  • meta tag with name="msapplication-wide310x150logo"
  • meta tag with name="msapplication-square310x310logo"
  • link tag with rel="apple-touch-icon" (if 'sizes' is provided, the link tag with the largest minimum dimension is selected)
  • link tag with rel="icon" (if 'sizes' is provided, the link tag with the largest minimum dimension is selected)
  • meta tag with name="msapplication-square150x150logo"
  • meta tag with name="msapplication-square70x70logo"
  • requesting "{scheme}://{domain}/favicon.ico" to see if it exists
  • the first img tag siblings with an h1 tag.

Metadata

Release files for urlimage-dcollien 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for urlimage-dcollien 0.0.1
File Size Uploaded Provenance Actions
urlimage-dcollien-0.0.1.tar.gz 3.4 kB Without provenance Details for urlimage-dcollien-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for urlimage-dcollien 0.0.1
File Interpreter ABI Platform Actions
urlimage_dcollien-0.0.1-py3-none-any.whl Python 3 none any Details for urlimage_dcollien-0.0.1-py3-none-any.whl

Total release size: 8.2 kB

Release files / urlimage-dcollien-0.0.1.tar.gz

Download URL urlimage-dcollien-0.0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9af0a2ab7bc326609514cb35f6a1d43e079df3f60e94238f82b25305d9ec7b79
BLAKE2b-256 checksum
How to use checksums
e0b690777c383d6414be5e0e55397b4c6fd6580d7a6282afac71cdf4c57d4185
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / urlimage_dcollien-0.0.1-py3-none-any.whl

Download URL urlimage_dcollien-0.0.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffb39642d5b91a727ef21a096deb2efbf7805abf66c2256eda178a0cd222a252
BLAKE2b-256 checksum
How to use checksums
f5d60b0d6af96c23a2a2e433b7a6e7c2c588e2529edc456ec435e96fb517abf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for urlimage-dcollien 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page