# Favicon Extractor: Brand Icons and Theme Color (`fecklesspleb/favicon-brand-extractor`) Actor

Favicon extractor for a list of websites: finds favicons, apple-touch-icons, manifest icons and og:image, verifies the bytes are real images, and returns up to 5 per site plus theme color and site name. Charged only when a verified asset is found ($2 per 1,000 sites). Plus $0.00005 start.

- **URL**: https://apify.com/fecklesspleb/favicon-brand-extractor.md
- **Developed by:** [fecklesspleb](https://apify.com/fecklesspleb) (community)
- **Categories:** Developer tools, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Favicon and Brand Asset Extractor

For each website URL, read the page (usually the homepage) and its linked web app manifest, then check icon candidates: icon, apple-touch-icon and mask-icon links, manifest icons, `/favicon.ico` and `og:image`. The dataset lists up to 5 candidates verified as real images, plus `theme-color`, site name and page title. Optionally save the top verified icon into an Apify key-value store.

**At a glance:** $2.00 per 1,000 sites ($0.002 per site), charged only when at least one icon or brand image is verified (fetched and recognised as image bytes), plus the Apify run-start event. Sites with no verified asset, failed sites, login pages and skipped sites are free.

### Behaviour

Per site the Actor fetches:

1. The page HTML (a non-HTML response fails the site, free). Query strings and fragments in the input URL are dropped.
2. The linked web app manifest (if any).
3. Icon candidates in priority order (apple-touch-icon, manifest icons, icon links and `/favicon.ico`, then `og:image`) until 5 are verified, none are left, or 10 candidates have been fetched (a hard cap per site). Candidates are fetched to verify them even when download is off.

robots.txt is checked on every hop, and requests to one host are spaced at least 0.5 s apart. No browser; JS-injected icons are not seen. A page that is a login page (login path or password field) fails free (tested locally).

#### SVG storage (security)

When the top icon is an SVG, it is stored in the key-value store as `text/plain` (not `image/svg+xml`) so opening the public store URL cannot run embedded script on the storage origin. The dataset row records `svgStoredAs: "text/plain"` and `iconContentType: "text/plain"`; `iconOriginalContentType` keeps the server's content type.

### Pricing

- `apify-actor-start`: $0.00005, the standard Apify start event (one per GB of memory, minimum 1).
- `site`: $0.002 per site with at least one verified icon or brand image ($2.00 per 1,000 sites). Saving the top icon, when enabled, is included.

Free: sites with no verified asset, non-HTML pages, HTTP errors, robots blocks, private-address blocks, login pages, sites skipped by **Max sites** or the cost limit, and invalid input. Set **Maximum cost per run** to stop cleanly.

### Call it from an API or an AI agent

One site per call is the typical agent pattern: about $0.00205 per call with a verified icon ($0.00005 start event + $0.002 site), $0.00005 when nothing is verified. Each call is a separate run with its own start event, so batch sites into one run when you can. Replace `<YOUR_APIFY_TOKEN>` with your token and keep it in a secret or credential; `maxTotalChargeUsd` caps what one run can cost.

One request that starts a run, waits for it and returns the dataset items (if the run takes longer than 300 seconds, the response is HTTP 408 and the run keeps going):

```bash
curl -X POST \
  -H "Authorization: Bearer <YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": [{"url": "https://www.python.org/"}], "maxSites": 1}' \
  "https://api.apify.com/v2/actors/fecklesspleb~favicon-brand-extractor/run-sync-get-dataset-items?maxTotalChargeUsd=0.01&format=json"
```

Python (`pip install apify-client`, written against version 3.5):

```python
from apify_client import ApifyClient

client = ApifyClient('<YOUR_APIFY_TOKEN>')
run = client.actor('fecklesspleb/favicon-brand-extractor').call(
    run_input={'startUrls': [{'url': 'https://www.python.org/'}], 'maxSites': 1},
    max_total_charge_usd=0.01,
)
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item.get('url'), item.get('bestIconUrl'), item.get('status'))
```

JavaScript (`npm install apify-client`):

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('fecklesspleb/favicon-brand-extractor').call(
    { startUrls: [{ url: 'https://www.python.org/' }], maxSites: 1 },
    { maxTotalChargeUsd: 0.01 },
);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map((i) => [i.url, i.bestIconUrl, i.status]));
```

AI agents: the [Apify MCP server](https://docs.apify.com/mcp) can expose this Actor as a tool. Add `https://mcp.apify.com?tools=fecklesspleb/favicon-brand-extractor` to an MCP client.

### Run it on a schedule

Use this when you want favicons and brand colours for a list of sites refreshed on a regular cadence.

**Example.** Keep company or product homepage URLs in the `startUrls` field and run it weekly. For each site the dataset lists up to 5 verified icon candidates, plus `theme-color`, site name and page title. When `downloadBestIcon` is `true` (the default), the top verified icon is also saved to the key-value store. A site is charged only when at least one icon or brand image is verified. Charges are unchanged; see Pricing.

#### Apify Schedules

You must have run the Actor at least once before you can schedule it. In [Apify Console](https://console.apify.com), open **Schedules** and click **Create new**. Set a name (3–63 characters) and a timezone (daylight saving is supported). Under **Schedule setup**, use the visual builder or a cron expression. For example, `0 8 * * *` runs every day at 08:00 in that timezone. Click **Add**, choose this Actor or a saved task, and optionally override the input, build, timeout or memory. If you leave the input empty, the Actor's default input is used. New schedules are created disabled; check the **Next runs** preview, then click **Enable**. One schedule can include at most 10 Actors and 10 tasks.

#### Webhook or dataset hand-off

On the Actor or a task, add a webhook for the event `ACTOR.RUN.SUCCEEDED` (you can also listen for `ACTOR.RUN.FAILED`). The event data includes `actorRunId`. Fetch that run's dataset items:

```bash
curl -H "Authorization: Bearer <YOUR_APIFY_TOKEN>" \
  "https://api.apify.com/v2/actor-runs/<RUN_ID>/dataset/items?format=json"
```

Keep the token in a credential or secret, never in a URL you share publicly. The API also accepts `?token=`, but the `Authorization` header is the recommended, more secure method. `format` may be `json` (the default), `jsonl`, `csv`, `xlsx`, `xml` or `rss`.

When `downloadBestIcon` is enabled, the top verified icon is in the run's key-value store (see the row's download fields). The dataset itself lists the verified candidates.

#### n8n

1. Install the [Apify node](https://docs.apify.com/integrations/n8n): on self-hosted n8n, go to Settings → Community Nodes and install `@apify/n8n-nodes-apify`; on n8n Cloud, search for Apify and install the node.
2. Create an **Apify API** credential and store `<YOUR_APIFY_TOKEN>` there (OAuth2 is also available on n8n Cloud). Do not put the token in a node URL.
3. Add an Apify **Run an Actor** node, select this Actor, and set the input JSON below. To get rows in the same step, use **Run an Actor and get dataset** instead, which waits for the run to finish and returns the dataset items.
4. If an Apify Schedule starts the run, use the **On new Apify Event** trigger (event type **Succeeded**), then **Get Dataset Items** with the run's default dataset id.
5. Send the items to a sheet, folder or the next node.

Works with Apify's native n8n, Make and Zapier integrations. For a scheduled run, start it from an Apify Schedule or a Schedule Trigger in n8n, then read the run's default dataset in the next node.

Example input for a scheduled run:

```json
{
  "startUrls": [{"url": "https://www.python.org/"}],
  "downloadBestIcon": true
}
```

#### Make

1. In a Make scenario, add the [Apify](https://docs.apify.com/integrations/make) app and connect with OAuth or an API token (store the token in the connection).
2. Add **Run an Actor**, select this Actor, and paste the same input JSON. Set **Run synchronously** to Yes only if the run will finish inside Make's synchronous timeout (Make's Apify app page states a 120-second maximum; Apify's Make docs say the timeout varies by plan). For longer runs, let an Apify Schedule start the Actor and use **Watch Actor Runs**, then **Get Dataset Items** with that run's default dataset id.
3. Map the items to Google Sheets, Drive, or the next module.

### Limits

- One page per site plus its manifest and at most 10 icon candidates; not a full site crawl.
- A candidate is not counted or saved if the response is not image bytes or is larger than the max icon size (default 5 MB).
- Concurrency is capped at 10 and lowered automatically to fit memory; private addresses blocked on the Apify platform.
- Returns only page-level brand metadata: site name, title, theme colour, and icon and `og:image` URLs.

### Legal

Use only on sites you are allowed to fetch. Obey robots.txt and terms.

# Changelog

This Actor's version history is a separate document: https://apify.com/fecklesspleb/favicon-brand-extractor/changelog.md

# Actor input Schema

## `startUrls` (type: `array`):

Homepage (or site) URLs to inspect.

## `downloadBestIcon` (type: `boolean`):

If true, save the top verified icon (priority: apple-touch-icon, manifest icon, icon link or /favicon.ico, then og:image) into the key-value store. Candidates are fetched to verify them either way.

## `maxFileSizeMb` (type: `number`):

Icon files larger than this are skipped and not saved.

## `maxSites` (type: `integer`):

0 = unlimited.

## `maxConcurrency` (type: `integer`):

How many sites to process in parallel. The Actor may lower this automatically so that parallel downloads fit in its memory.

## `keyValueStoreName` (type: `string`):

Optional named key-value store for saved icons; the default run store is used if empty.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.python.org/"
    }
  ],
  "downloadBestIcon": true,
  "maxFileSizeMb": 5,
  "maxSites": 0,
  "maxConcurrency": 5
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://www.python.org/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fecklesspleb/favicon-brand-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": [{ "url": "https://www.python.org/" }] }

# Run the Actor and wait for it to finish
run = client.actor("fecklesspleb/favicon-brand-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.python.org/"
    }
  ]
}' |
apify call fecklesspleb/favicon-brand-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fecklesspleb/favicon-brand-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/SYJs2uTswkbH6aC8G/builds/6ff6p6bTxyhrFeZsm/openapi.json
