# Discord Ultimate Scraper (`khnaami/actor-discord-scraper`) Actor

Resolve Discord public invites to get real-time member & online counts, server banners, features, and extract channel chat history with zero bot installation.

- **URL**: https://apify.com/khnaami/actor-discord-scraper.md
- **Developed by:** [khalid naami](https://apify.com/khnaami) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## 🎮 Discord Ultimate Scraper & Server Finder (Servers, Members, Online Counts & Messages)

High-speed, all-in-one Discord data extractor and community discovery engine on Apify. Extract **Public Discord Servers & Guilds** (total member counts, online presence, icons, banners, verification status), **Channel Messages & Chat History**, and **Automated Server Finder by Keyword** without needing a bot.

***

### ⚡ Key Features

- 🌐 **Zero Bot / Zero Token Required for Servers**: Resolves any Discord invite link (`discord.gg/...`, `discord.com/invite/...`) via Discord's public API to get real-time member counts and online presence without needing a bot in the server.
- 👥 **Server & Guild Intelligence**: Extract Server Name, Description, Total Members (`approximate_member_count`), Online Members (`approximate_presence_count`), Server Icons/Banners, Vanity URL, and Guild Features.
- 💬 **Channel Messages & History**: Extract messages with author usernames, avatars, bot flags, timestamps, attachments, and reaction counters.
- 🔍 **Automated Server Finder by Keyword**: Search and discover public Discord servers and communities based on any niche or keyword (e.g., *artificial intelligence*, *indie hackers*, *crypto alpha*, *gaming*).
- 📧 **Direct Lead Generation**: Automatically extracts business contact emails, phone numbers, and external links found in server descriptions and welcome text.
- 🛡️ **Blazing Speed & Anti-Throttling**: Lightweight direct API requests powered by `got-scraping` with Apify Proxy support.

***

### 📥 Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `mode` | String | `AUTO_DETECT` | Extraction mode: `AUTO_DETECT`, `SERVERS`, `MESSAGES`, `SERVER_FINDER`. |
| `targetUrls` | Array | `[...]` | List of Discord invite links (`https://discord.gg/python`, etc.). |
| `searchKeywords` | Array | `[]` | Keywords to discover public Discord servers across the web. |
| `channelIds` | Array | `[]` | Channel IDs to scrape message history from (requires `discordToken`). |
| `maxMessages` | Integer | `50` | Maximum messages to extract per channel. |
| `maxItems` | Integer | `30` | Maximum servers or discovery items to process. |
| `discordToken` | String | `""` | Optional Discord Bot or User token for private channel message scraping. |
| `proxyConfiguration` | Object | `{ useApifyProxy: true }` | Apify Residential proxy configuration (recommended). |

***

### 📤 Output Data Format

#### 1. Discord Public Server Record

```json
{
  "type": "SERVER",
  "id": "267624335836053504",
  "url": "https://discord.gg/python",
  "inviteCode": "python",
  "serverName": "Python",
  "serverDescription": "The official Discord server for the Python programming language community. Contact: admins@pythondiscord.com",
  "approximateMemberCount": 385000,
  "approximatePresenceCount": 94000,
  "iconUrl": "https://cdn.discordapp.com/icons/267624335836053504/a_123.png?size=512",
  "bannerUrl": "https://cdn.discordapp.com/banners/267624335836053504/456.png?size=1024",
  "vanityUrlCode": "python",
  "features": [
    "COMMUNITY",
    "VERIFIED",
    "PARTNERED",
    "VANITY_URL",
    "DISCOVERABLE"
  ],
  "verificationLevel": 3,
  "emails": [
    "admins@pythondiscord.com"
  ],
  "scrapedAt": "2026-10-09T13:25:00.000Z"
}
```

#### 2. Discord Channel Message Record

```json
{
  "type": "MESSAGE",
  "id": "123456789012345678",
  "messageId": "123456789012345678",
  "channelId": "987654321098765432",
  "url": "https://discord.com/channels/@me/987654321098765432/123456789012345678",
  "content": "Check out our latest release notes on GitHub!",
  "authorUsername": "dev_lead",
  "authorGlobalName": "Alex Rivera",
  "authorId": "112233445566778899",
  "isBot": false,
  "timestamp": "2026-10-09T11:45:00.000Z",
  "reactions": [
    { "emoji": "🚀", "count": 42 },
    { "emoji": "🎉", "count": 28 }
  ],
  "externalLinks": [
    "https://github.com/project/release/v2"
  ],
  "scrapedAt": "2026-10-09T13:25:00.000Z"
}
```

***

### 💼 Business & Lead Generation Use Cases

- **Developer & Web3 Community Sourcing**: Identify the largest and most active Discord servers in your tech stack.
- **Market Sizing & Community Tracking**: Track daily active member growth and engagement in target niche servers.
- **Partnership & Influencer Outreach**: Find server owners and community admins for sponsorships and co-marketing.

***

### 📄 License

Apache-2.0

# Actor input Schema

## `mode` (type: `string`):

Select Discord extraction mode, or use AUTO_DETECT.

## `targetUrls` (type: `array`):

List of Discord invite links (e.g., https://discord.gg/python or https://discord.gg/openai).

## `searchKeywords` (type: `array`):

Keywords to discover public Discord communities across the web.

## `channelIds` (type: `array`):

Channel IDs to extract message history from (requires discordToken).

## `maxMessages` (type: `integer`):

Maximum number of messages to extract per channel.

## `maxItems` (type: `integer`):

Maximum number of servers or discovery results to process.

## `discordToken` (type: `string`):

Optional Discord Bot or User token for extracting channel messages. Not needed for public server invites.

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

Select Apify Proxy (RESIDENTIAL recommended to avoid rate limits).

## Actor input object example

```json
{
  "mode": "AUTO_DETECT",
  "targetUrls": [
    "https://discord.gg/python",
    "https://discord.gg/openai"
  ],
  "searchKeywords": [
    "artificial intelligence community",
    "indie hackers startups"
  ],
  "maxMessages": 50,
  "maxItems": 30,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Scraped Discord records (Servers, Guilds, Members, Messages, Channels)

## `overview` (type: `string`):

High-level summary report and execution metrics stored in Key-Value store

# 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 = {
    "targetUrls": [
        "https://discord.gg/python",
        "https://discord.gg/openai"
    ],
    "searchKeywords": [
        "artificial intelligence community",
        "indie hackers startups"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("khnaami/actor-discord-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 = {
    "targetUrls": [
        "https://discord.gg/python",
        "https://discord.gg/openai",
    ],
    "searchKeywords": [
        "artificial intelligence community",
        "indie hackers startups",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("khnaami/actor-discord-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 '{
  "targetUrls": [
    "https://discord.gg/python",
    "https://discord.gg/openai"
  ],
  "searchKeywords": [
    "artificial intelligence community",
    "indie hackers startups"
  ]
}' |
apify call khnaami/actor-discord-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khnaami/actor-discord-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/5IPAYlYVlmJawZ7t6/builds/ld21lhepwgIBlhqF0/openapi.json
