> ## Documentation Index
> Fetch the complete documentation index at: https://docs.searchcompany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Favicon

<Note>
  **Internal Service** — This is not an HTTP endpoint. It's called by the enhanced logo service.
</Note>

## Purpose

Downloads the favicon from a website using multiple fallback methods.

## Function Signature

```python theme={null}
async def fetch_favicon(website_url: str) -> Optional[dict]
```

## Parameters

| Parameter     | Type  | Description                           |
| ------------- | ----- | ------------------------------------- |
| `website_url` | `str` | The website URL to fetch favicon from |

## Returns

```python theme={null}
{
    "bytes": b"...",      # Raw favicon bytes
    "png_bytes": b"...",  # Converted to PNG
    "url": "https://..."  # Source URL
}
```

Returns `None` if no favicon found.

## Favicon Discovery Order

1. **Parse HTML** - Look for `<link rel="icon">` tags
2. **Common paths** - Try `/favicon.ico`, `/favicon.png`, `/apple-touch-icon.png`
3. **Google fallback** - `https://www.google.com/s2/favicons?domain={domain}&sz=256`

## Code Location

```
src/website/enhanced_logo/service.py
# Lines 70-167: fetch_favicon()
```
