# Website Social Links Scraper (`codescraper/website-social-links-scraper`) Actor

Blazing fast scraper to extract social media links (Facebook, Twitter, LinkedIn, Instagram, etc.) from websites. Includes advanced filtering to avoid share links and deduplication by domain.

- **URL**: https://apify.com/codescraper/website-social-links-scraper.md
- **Developed by:** [CodeScraper](https://apify.com/codescraper) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 4 total users, 3 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.00 / 1,000 social profile extracteds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Social Links Scraper – High-Speed Profile Extractor

This **Apify actor** extracts **social media profiles and community links directly from websites** with high accuracy and intelligent validation.

It combines **Cheerio-based HTML scraping, advanced regex matching, smart brand-name filtering, internal link discovery, and domain-level aggregation** to identify, validate, deduplicate, and organize social profiles while filtering out share links, tracking URLs, irrelevant external pages, and false positives.

---

### 🚀 What It Does

For every website URL provided, the actor extracts:

#### 🏢 Website Overview

* 🌐 **Input URL**
* 🔗 **Target Domain**
* 🏷️ **Brand Name**
* 📊 **Pages Scanned**
* 🧮 **Total Profiles Found**

---

#### 📱 Social Profile Data

For each social platform found:

* 🐦 **Twitter / X**
* 💼 **LinkedIn**
* 📸 **Instagram**
* 📘 **Facebook**
* 🎥 **YouTube**
* 🎵 **TikTok**
* 🐙 **GitHub**
* 👾 **Discord**
* 👽 **Reddit**
* 📌 **Pinterest**

---

### ⚡ It Handles

* ✅ **Multiple website URLs and raw domains**
* 🔄 **Automatic URL normalization**
* ⚡ **High-speed raw HTML scraping**
* 🛡️ **Anti-blocking capabilities**
* 🧠 **Smart Brand-Name Filtering**
* 🚫 **Share-link and intent-link filtering**
* 🧹 **Domain-level deduplication**
* 🔗 **Same-hostname internal crawling**
* 📊 **Cross-page profile aggregation**
* 🎯 **Platform-specific validation**

---

### 🧠 How It Works

1. Loads website URLs and normalizes domains

2. Extracts the base domain and brand name

3. Fetches raw HTML using **CheerioCrawler** with optimized request handling

4. Scans:

   * HTML content
   * Anchor tags
   * Embedded JSON data
   * Next.js hydration data
   * Structured metadata

5. Uses advanced regular expressions to identify social profile URLs

6. Filters:

   * Share links
   * Intent endpoints
   * Tracking parameters
   * Non-profile URLs

7. Applies **Smart Brand-Name Validation** to ensure profiles belong to the target website

8. Discovers and crawls internal pages such as:

   * Contact pages
   * About pages
   * Team pages
   * Community pages

9. Aggregates and deduplicates profiles across all crawled pages

10. Saves structured results to the Apify Dataset

---

### ⚙️ Input Configuration

| Field                | Type    | Description                               | Default                             |
| -------------------- | ------- | ----------------------------------------- | ----------------------------------- |
| `startUrls`          | Array   | List of website URLs or domains to scrape | `[]`                                |
| `platforms`          | Array   | Social platforms to extract               | `["facebook","twitter","linkedin"]` |
| `maxPagesPerDomain`  | Integer | Maximum pages to crawl per domain         | `10`                                |
| `proxyConfiguration` | Object  | Proxy settings for anti-blocking          | `{"useApifyProxy":true}`            |

---

### 🧩 Example Input

```json
{
  "startUrls": [
    "apify.com"
  ],
  "platforms": [
    "twitter",
    "linkedin",
    "youtube",
    "tiktok",
    "github",
    "discord"
  ],
  "maxPagesPerDomain": 5
}
````

***

### 📊 Example Output

```json
{
  "inputUrl": "https://apify.com",
  "targetDomain": "apify.com",
  "brandName": "apify",
  "statistics": {
    "pagesScanned": 5,
    "totalProfilesFound": 8
  },
  "socialProfiles": {
    "twitter": [
      "https://x.com/apify"
    ],
    "linkedin": [
      "https://linkedin.com/company/apify"
    ],
    "youtube": [
      "https://www.youtube.com/apify"
    ],
    "tiktok": [
      "https://www.tiktok.com/@apifytech"
    ],
    "github": [
      "https://github.com/apify"
    ],
    "discord": [
      "https://discord.com/invite/jyEM2PRvMU",
      "https://discord.gg/w3e2v7rWDw"
    ]
  }
}
```

***

If no social profiles are found:

```json
{
  "inputUrl": "https://example.com",
  "targetDomain": "example.com",
  "brandName": "example",
  "statistics": {
    "pagesScanned": 2,
    "totalProfilesFound": 0
  },
  "socialProfiles": {}
}
```

***

### ❌ Error Handling

If a website cannot be accessed or processed:

```json
{
  "inputUrl": "https://example.com",
  "targetDomain": "example.com",
  "status": "Failed",
  "error": "Request failed completely (check proxy or rate limits)",
  "statistics": {
    "pagesScanned": 0,
    "totalProfilesFound": 0
  },
  "socialProfiles": {}
}
```

***

### 🧠 Features

- 🌐 **Accurate social profile extraction**
- ⚡ **High-speed HTML-based scraping**
- 🛡️ **Built-in anti-blocking mechanisms**
- 🧠 **Smart brand-name validation**
- 🔗 **Automatic internal page discovery**
- 🧹 **Cross-page deduplication**
- 📊 **Domain-level aggregation**
- 🎯 **Platform-specific filtering**
- 🚫 **Share-link elimination**
- 🏷️ **Structured social profile organization**

***

### 💡 Use Cases

- **B2B Lead Generation**
- **CRM Data Enrichment**
- **Influencer Discovery**
- **Brand Intelligence Research**
- **Competitor Analysis**
- **Sales Prospecting**
- **Community Discovery**
- **Cold Outreach Campaigns**

***

### ❓ FAQs

#### 1. Why is it so fast?

The actor downloads and processes raw HTML directly instead of launching a full browser session. Combined with CheerioCrawler and optimized parsing, it delivers significantly higher throughput while minimizing resource consumption.

***

#### 2. Will it work on JavaScript-heavy websites?

In many cases, yes. Modern frameworks such as Next.js and Nuxt often embed their application state directly into HTML. Since the scraper scans the entire HTML response, including embedded JSON data, it can frequently extract social profiles without rendering JavaScript.

***

#### 3. How does Smart Brand-Name Filtering work?

The actor extracts the website's brand name from its domain and validates discovered social profile handles against that brand. This prevents unrelated user profiles from being incorrectly associated with the target website.

***

#### 4. Why are Discord links treated differently?

Discord invite URLs typically contain randomized invite codes rather than brand names. To avoid missing legitimate community links, Discord URLs are exempt from strict brand-name validation.

***

### 🧑‍💻 Developer Info

**Author:** codescraper

**Email:** <codescraper011@gmail.com>

***

### 🏷️ Tags

`social-scraper` · `social-links-extractor` · `lead-generation` · `data-enrichment` · `osint` · `b2b-data` · `contact-extractor` · `web-scraping`

# Actor input Schema

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

List of website URLs or domains you want to extract social links from (e.g., apify.com or https://github.com).

## `platforms` (type: `array`):

Select the social media platforms you want to extract.

## `maxPagesPerDomain` (type: `integer`):

Maximum number of pages to crawl per domain to find social links. Setting this to 5-10 is usually enough to find all links.

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

Proxy settings to bypass blocking.

## Actor input object example

```json
{
  "startUrls": [
    "apify.com",
    "github.com"
  ],
  "platforms": [
    "facebook",
    "twitter",
    "linkedin",
    "instagram",
    "youtube",
    "tiktok",
    "github",
    "discord"
  ],
  "maxPagesPerDomain": 10
}
```

# Actor output Schema

## `full_dataset` (type: `string`):

Download the complete dataset of extracted social media profiles.

# 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": [
        "apify.com",
        "github.com"
    ],
    "platforms": [
        "facebook",
        "twitter",
        "linkedin",
        "instagram",
        "youtube",
        "tiktok",
        "github",
        "discord"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("codescraper/website-social-links-scraper").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": [
        "apify.com",
        "github.com",
    ],
    "platforms": [
        "facebook",
        "twitter",
        "linkedin",
        "instagram",
        "youtube",
        "tiktok",
        "github",
        "discord",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("codescraper/website-social-links-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "apify.com",
    "github.com"
  ],
  "platforms": [
    "facebook",
    "twitter",
    "linkedin",
    "instagram",
    "youtube",
    "tiktok",
    "github",
    "discord"
  ]
}' |
apify call codescraper/website-social-links-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=codescraper/website-social-links-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Website Social Links Scraper",
        "description": "Blazing fast scraper to extract social media links (Facebook, Twitter, LinkedIn, Instagram, etc.) from websites. Includes advanced filtering to avoid share links and deduplication by domain.",
        "version": "1.0",
        "x-build-id": "dXKveZydXDBLF42jb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/codescraper~website-social-links-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-codescraper-website-social-links-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/codescraper~website-social-links-scraper/runs": {
            "post": {
                "operationId": "runs-sync-codescraper-website-social-links-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/codescraper~website-social-links-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-codescraper-website-social-links-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "startUrls",
                    "platforms",
                    "maxPagesPerDomain"
                ],
                "properties": {
                    "startUrls": {
                        "title": "Start URLs",
                        "type": "array",
                        "description": "List of website URLs or domains you want to extract social links from (e.g., apify.com or https://github.com).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "platforms": {
                        "title": "Social Platforms to Extract",
                        "type": "array",
                        "description": "Select the social media platforms you want to extract.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "facebook",
                                "twitter",
                                "linkedin",
                                "instagram",
                                "youtube",
                                "tiktok",
                                "github",
                                "discord",
                                "reddit",
                                "pinterest"
                            ],
                            "enumTitles": [
                                "Facebook",
                                "Twitter (X)",
                                "LinkedIn",
                                "Instagram",
                                "YouTube",
                                "TikTok",
                                "GitHub",
                                "Discord",
                                "Reddit",
                                "Pinterest"
                            ]
                        }
                    },
                    "maxPagesPerDomain": {
                        "title": "Max Pages Per Domain",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of pages to crawl per domain to find social links. Setting this to 5-10 is usually enough to find all links.",
                        "default": 10
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings to bypass blocking."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
