# X(Twitter) Popular Communities Scraper (`powerai/twitter-popular-community-scraper`) Actor

Discover popular X Communities by topic—names, rules, member counts, and rich Community objects in structured rows.

- **URL**: https://apify.com/powerai/twitter-popular-community-scraper.md
- **Developed by:** [PowerAI](https://apify.com/powerai) (community)
- **Categories:** Social media, Lead generation, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 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/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

## X Popular Communities Scraper

Browse **popular X Communities** for a chosen **topic**—the same kind of spaces people discover when exploring Communities by category. Each dataset row is one Community with nested details such as name, description, rules, member counts, banners, themes, facepile members, and admin or creator profiles when returned.

### Who it’s for

- **Community managers & moderators** researching active spaces in a theme.  
- **Marketers & analysts** mapping topic ecosystems on X.  
- **Researchers** who want structured exports instead of manual browsing.

### What you can do with it

- **Pick a topic id** that matches a Community category (for example technology or hobby topics exposed in the product).  
- **Collect many Communities** in one run until you reach the limit you set or there are no more results.  
- **Match every row** to the topic you asked for via **`requestedTopicId`**, plus **`scrapedAt`** on each row.

### How it works (in plain terms)

You enter the **topic id** (the same identifier used when X groups Communities by topic). The tool loads results in successive batches until your **maximum row count** is reached or the list ends—you do not need to manage paging yourself.

### Input

| Field | Required | What it means |
|-------|----------|----------------|
| **Topic ID** (`topicId`) | Yes | Which topic’s popular Communities to list. |
| **Maximum results** (`maxResults`) | No | Upper limit on how many community rows to collect (default **50**). |

### Output

- **One row per Community** (until your cap). Rows are often **large** (hundreds of lines of JSON when fully expanded).  
- **Identity & basics**: **`__typename`** (`Community`), **`name`**, **`description`**, **`access`**, numeric **`rest_id`**, **`created_at`** (epoch-style when returned), **`question`**, **`role`** (e.g. viewer vs member), **`is_nsfw`**, **`is_pinned`**.  
- **Scale & activity**: **`member_count`**, **`moderator_count`**, **`new_tweet_count_since_last_viewed`**.  
- **Topic tag**: **`primary_community_topic`** with **`topic_id`** and **`topic_name`**.  
- **Policies & invites**: **`join_policy`**, **`join_requests_result`**, **`invites_policy`**, **`invites_result`**.  
- **Presentation**: **`custom_theme`**, **`default_theme`**, **`custom_banner_media`** and **`default_banner_media`** (imagery, palettes, **`media_key`**).  
- **Discovery helpers**: **`search_tags`**, **`trending_hashtags_slice`** (often an **`items`** array, sometimes empty).  
- **Rules**: **`rules`** entries can include **`name`**, optional **`description`**, **`rest_id`**.  
- **Actions**: **`actions`** (`CommunityActions`) may expose join/leave/spotlight-style results.  
- **People**: **`admin_results`** and **`creator_results`** embed **`User`** objects with rich **`legacy`** profiles; **`members_facepile_results`** lists sample members the same way.  
- **Export metadata**: **`requestedTopicId`** repeats the topic you entered; **`scrapedAt`** is when that row was saved.

Optional sections vary by Community; some fields appear only in certain contexts. Details may change as X updates its product.

#### Sample output (one dataset row, heavily trimmed)

The snippet below uses field names and values from a real run; nested user and media blocks are omitted or shortened.

```json
{
  "__typename": "Community",
  "access": "Public",
  "actions": {
    "__typename": "CommunityActions",
    "community_spotlight_setup_action_result": {
      "__typename": "CommunitySpotlightSetupActionShow",
      "deeplink": "twitter://profile_spotlight"
    },
    "join_action_result": { "__typename": "CommunityJoinAction" },
    "leave_action_result": {
      "__typename": "CommunityLeaveActionUnavailable",
      "message": "Not a member.",
      "reason": "ViewerNotMember"
    }
  },
  "created_at": 1670743786266,
  "custom_theme": "Red",
  "default_theme": "Plum",
  "description": "Share AI-generated creations, news, tips and more. Sponsored by @higgsfield",
  "invites_policy": "MemberInvitesAllowed",
  "is_nsfw": false,
  "join_policy": "Open",
  "member_count": 245954,
  "moderator_count": 14,
  "name": "Generative AI",
  "new_tweet_count_since_last_viewed": 0,
  "primary_community_topic": {
    "topic_id": "302",
    "topic_name": "Artificial Intelligence"
  },
  "question": "",
  "rest_id": "1601841656147345410",
  "role": "NonMember",
  "rules": [
    {
      "description": "Harassment, bullying, or toxic behavior won’t be tolerated.",
      "name": "Be kind and respectful.",
      "rest_id": "1831180873569333471"
    }
  ],
  "search_tags": ["generative", "ai", "midjourney", "chatgpt"],
  "trending_hashtags_slice": { "items": [] },
  "requestedTopicId": "302",
  "scrapedAt": "2026-03-26T01:01:07.161Z"
}
````

`admin_results`, `creator_results`, `members_facepile_results`, and full banner media trees are omitted here but appear in full dataset rows.

### Good to know

- The **topic id** must match a topic X recognizes; unknown ids may return few or no rows.
- Respect X’s rules and applicable laws when using exported data.

# Actor input Schema

## `topicId` (type: `string`):

The id of the Community topic to browse (for example Artificial Intelligence). Use the same id you see when picking a topic in X’s Community topic list.

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

How many community rows to save in total.

## Actor input object example

```json
{
  "topicId": "302",
  "maxResults": 10
}
```

# 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 = {
    "topicId": "302",
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("powerai/twitter-popular-community-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 = {
    "topicId": "302",
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("powerai/twitter-popular-community-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 '{
  "topicId": "302",
  "maxResults": 10
}' |
apify call powerai/twitter-popular-community-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=powerai/twitter-popular-community-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "X(Twitter) Popular Communities Scraper",
        "description": "Discover popular X Communities by topic—names, rules, member counts, and rich Community objects in structured rows.",
        "version": "0.0",
        "x-build-id": "Y7a4IpIw2NlQVL3E8"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/powerai~twitter-popular-community-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-powerai-twitter-popular-community-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/powerai~twitter-popular-community-scraper/runs": {
            "post": {
                "operationId": "runs-sync-powerai-twitter-popular-community-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/powerai~twitter-popular-community-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-powerai-twitter-popular-community-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": [
                    "topicId"
                ],
                "properties": {
                    "topicId": {
                        "title": "Topic ID",
                        "type": "string",
                        "description": "The id of the Community topic to browse (for example Artificial Intelligence). Use the same id you see when picking a topic in X’s Community topic list.",
                        "default": "302"
                    },
                    "maxResults": {
                        "title": "Maximum results",
                        "minimum": 10,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "How many community rows to save in total.",
                        "default": 10
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
