# 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:** 36 total users, 11 monthly users, 95.5% runs succeeded, 3 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.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/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 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": 5
}
```

# 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(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": [
    "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": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codescraper/website-social-links-scraper"
        }
    }
}

```

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/meU6XrAxXviSICIXQ/builds/k8UVAPEY9bXKvrwAh/openapi.json
