Favicon Extractor

0.7.0 · maintenance · verified Mon Apr 13

favicon is a Python library designed to find and extract a website's favicon. It simplifies the process of locating favicons, which can be in various locations on a website. The current version is 0.7.0, released in August 2019. The release cadence appears to be infrequent.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `favicon` library and use its `get()` function to retrieve a list of `Favicon` objects for a given URL. It then prints the URL and dimensions of the first found favicon.

import favicon

# Example URL
url = "https://www.google.com"

# Get all favicons for the URL
icons = favicon.get(url)

# The 'icons' variable is a list of Favicon objects.
# Each Favicon object has attributes like .url, .width, .height, .format.

if icons:
    # Print the URL of the first (and often best) favicon
    print(f"Found favicon URL: {icons[0].url}")
    # You can also access other properties
    print(f"Size: {icons[0].width}x{icons[0].height}")
else:
    print(f"No favicons found for {url}")

view raw JSON →