# Fetch Branding (`jotunweb/fetch-branding`) Actor

Apify Actor for extracting branding information from websites including logos, colors, metadata, and social links.

- **URL**: https://apify.com/jotunweb/fetch-branding.md
- **Developed by:** [Jotunweb](https://apify.com/jotunweb) (community)
- **Categories:** Developer tools, Other
- **Stats:** 124 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00 / 1,000 results

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Website Branding Extractor

An Apify Actor that extracts comprehensive branding information from websites including logos, colors, metadata, and social media links.

### Features

- **Logo Extraction**: Favicon, apple-touch-icon, Open Graph images, and common logo selectors
- **Color Detection**: CSS custom properties and inline style colors
- **Metadata Extraction**: Meta tags, Open Graph, and Twitter Card data
- **Social Media Links**: Detects links to major social platforms
- **Error Handling**: Comprehensive error reporting for failed extractions
- **Configurable Output**: Filter results by success status and limit processing

### How it works

1. **Input Processing**: Accepts URLs via `startUrls` array
2. **HTTP Fetching**: Uses Axios with timeout, user-agent spoofing, and redirect handling
3. **HTML Parsing**: Parses content with Cheerio for data extraction
4. **Multi-faceted Extraction**: Simultaneously extracts logos, colors, metadata, and social links
5. **Result Filtering**: Applies configurable filters based on success status and limits
6. **Data Storage**: Stores results in Apify Dataset with multiple view options

### Input Configuration

The Actor accepts the following input parameters:

#### URLs

- **Start URLs**: Array of websites to extract branding from

#### Extraction Options

- **Extract Logos**: Enable/disable logo detection (default: true)
- **Extract Colors**: Enable/disable color extraction (default: true)
- **Extract Metadata**: Enable/disable metadata extraction (default: true)
- **Extract Social Links**: Enable/disable social media link detection (default: true)

#### Request Configuration

- **Timeout**: Request timeout in milliseconds (default: 30000)
- **Max Redirects**: Maximum redirects to follow (default: 5)
- **User Agent**: Custom user agent string

#### Output Options

- **Include Failed URLs**: Include failed extractions in output (default: true)
- **Max Results**: Maximum number of URLs to process (default: 1000)
- **Only Successful**: Filter to only successful extractions (default: false)

#### Proxy Configuration

- **Proxy Configuration**: Optional Apify proxy settings

### Output Data

Each extracted result contains:

```json
{
  "url": "https://example.com/",
  "success": true,
  "title": "Example Site",
  "description": "An example website description",
  "logo": [
    {
      "url": "https://example.com/favicon.ico",
      "type": "favicon",
      "sizes": "32x32"
    }
  ],
  "colors": {
    "primary": "#007bff",
    "secondary": "#6c757d"
  },
  "metadata": {
    "keywords": "example, website",
    "ogTitle": "Example Site",
    "twitterCard": "summary"
  },
  "socialLinks": [
    "https://twitter.com/example",
    "https://facebook.com/example"
  ],
  "timestamp": "2024-01-01T12:00:00.000Z"
}
```

For failed extractions, the result includes an `error` field with details about the failure.

### Dataset Views

The Actor provides multiple views of the extracted data:

- **Overview**: Basic results without error details
- **Detailed**: Complete data including errors and metadata
- **Logo Assets**: Individual logo entries for analysis
- **Failed Extractions**: Only URLs that failed processing

### Getting Started

#### Local Development

```bash
## Install dependencies
npm install

## Run locally
apify run

## Build for production
npm run build
```

#### Deploy to Apify

1. **Connect Git Repository**:
   - Go to [Actor creation page](https://console.apify.com/actors/new)
   - Click **Link Git Repository**

2. **Push from Local Machine**:
   ```bash
   # Login to Apify
   apify login

   # Deploy Actor
   apify push
   ```

### Supported Platforms

#### Logo Sources

- Favicon links
- Apple touch icons
- Open Graph images
- Common logo selectors (alt/src/class containing "logo")

#### Social Media Platforms

- Facebook
- Twitter/X
- Instagram
- LinkedIn
- YouTube
- TikTok
- Pinterest
- Snapchat
- GitHub
- GitLab
- BitBucket

#### Metadata Standards

- Basic HTML meta tags
- Open Graph protocol
- Twitter Cards
- Viewport and charset information

### Error Handling

The Actor provides detailed error messages for common scenarios:

- **Network Issues**: Domain not found, connection refused
- **HTTP Errors**: 403 (forbidden), 404 (not found), 429 (rate limited), 5xx (server errors)
- **Timeouts**: Request timeout handling
- **Invalid URLs**: URL format validation

### Technical Details

- **Framework**: Built with Apify SDK and TypeScript
- **HTTP Client**: Axios with comprehensive error handling
- **HTML Parser**: Cheerio for server-side DOM manipulation
- **Rate Limiting**: 1-second delay between requests for multiple URLs
- **URL Resolution**: Automatic conversion of relative URLs to absolute URLs

### Resources

- [Apify SDK Documentation](https://docs.apify.com/sdk/js)
- [Apify Platform Documentation](https://docs.apify.com/platform)
- [Actor Console](https://console.apify.com/actors)
- [Join Developer Community](https://discord.com/invite/jyEM2PRvMU)

# Actor input Schema

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

List of URLs to extract branding information from. You can add multiple URLs to process them in batch.

## `extractLogos` (type: `boolean`):

Extract favicon, apple-touch-icon, og:image, and other logo assets

## `extractColors` (type: `boolean`):

Extract brand colors from CSS variables and inline styles

## `extractMetadata` (type: `boolean`):

Extract meta tags, Open Graph, and Twitter Card data

## `extractSocialLinks` (type: `boolean`):

Extract social media profile links

## `timeout` (type: `integer`):

Maximum time to wait for each request in milliseconds

## `maxRedirects` (type: `integer`):

Maximum number of redirects to follow

## `userAgent` (type: `string`):

User agent string to use for requests

## `includeFailedUrls` (type: `boolean`):

Include URLs that failed to extract branding data in the output

## `maxResults` (type: `integer`):

Maximum number of URLs to process (0 = unlimited)

## `onlySuccessful` (type: `boolean`):

Only output URLs where branding extraction was successful

## `proxyConfiguration` (type: `object`):

Configure proxy settings for requests

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.apify.com/"
    }
  ],
  "extractLogos": true,
  "extractColors": true,
  "extractMetadata": true,
  "extractSocialLinks": true,
  "timeout": 30000,
  "maxRedirects": 5,
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
  "includeFailedUrls": true,
  "maxResults": 1000,
  "onlySuccessful": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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.apify.com/"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("jotunweb/fetch-branding").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.apify.com/" }],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("jotunweb/fetch-branding").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.apify.com/"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call jotunweb/fetch-branding --silent --output-dataset

```

## MCP server setup

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

```

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/AJ1VJyIXLRhc6BTSF/builds/bUvaSDTEemLsAqApY/openapi.json
